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时间,如果连接池中的活动连接不高于初始容量个,那么连接池中连接的数量会减少到初始容量大。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值