weblogic 如何進行連接回收

一、gc回收 web應用 → 連接池回收

weblogic jconnector Garbage Collector Method:(wls api)

WebLogic Server automatically detects connection leaks by leveraging its Java Virtual Machine
(JVM) garbage collector mechanism. When an application component terminates and the
connections it uses become dereferenced, the garbage collector calls the connection object’s
finalize() method.

When the garbage collector calls the finalize() method, if WebLogic Server determines the
application component has not closed the connection, the server automatically closes the
connection by calling the resource adapter’s ManagedConnection.cleanup() method;
WebLogic Server behaves as it would had it received a CONNECTION_CLOSED event upon proper
closure of the application component connection. 

通過JVM垃圾回收機制,wls服務器能自發探測連接泄露,當應用終止而其所使用的連接變爲孤兒時,

垃圾回收器就調用連接對象的finalize方法

垃圾回收器調用finalize方法時,如果wls服務器確定是應用沒有關閉連接,

wls服務器將調用資源適配器的ManagedConnection的cleanup方法自動關閉連接,

weblogic服務器表現得就像它本來應該接收 應用組件連接的其中某個連接上的一個CONNECTION_CLOSED事件

 

二、程序顯式回收 web應用→連接池

Connection.close()方法調用後,weblogic監控到該動作,由連接池回收並管理連接

 

 

三、weblogic的無效鏈接回收

inactive connection timeout 經過設定時間,回收無效鏈接

 

 

四、weblogic的連接池自動收縮

Allow Shrinking: 允許自動收縮。如果連接池的初始容量和最大容量不相等,那麼當池中的連接大於初始容量時,經過Shrink Frequency時間,如果連接池中的活動連接不高於初始容量個,那麼連接池中連接的數量會減少到初始容量大。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章