数据库连接在glassfish空闲超时后不会释放 [英] Database Connection does not release after idle time out in glassfish

查看:553
本文介绍了数据库连接在glassfish空闲超时后不会释放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Glassfish 3& mysql5.6.11。

我在glassfish中创建了 JDBC连接池。

i have created JDBC connection pool in glassfish.

Initial and Minimum Pool Size: - 8
Maximum Pool Size: -30
Pool Resize Quantity:- 10
Idle Timeout: - 60 (second).
Max Wait Time:- 2500 (millisecond).

使用此参数我已创建池设置。

with this parameter i have created pool setting.

我有设置池大小数量值

当没有连接增加时,它不释放空闲超时后。
下一次当我打到url时,再次增加连接的数量,它不会重用已经打开的连接。

when no of connections increase, it does not release after idle time-out. next time when i hit url it again increase no of connection, it does not reuse already open connection.

我收到异常

java.sql.SQLException: Error in allocating a connection. Cause: In-use connections equal max-pool-size and expired max-wait-time. Cannot allocate more connections.

我使用mysql中的show processlist显示打开的连接。

i am using show processlist in mysql to show open connection.

如果有人知道这个问题的解决方法,请与我分享您的想法。

if any one knows the solution of this problem, please share your idea with me.

我需要任何人的帮助。

推荐答案

闲置超时只是在池中未使用的连接在关闭/回收之前保留在池中的时间。您遇到的问题很可能是您在使用后未关闭连接。

Idle timeout is just the time that unused connections in the pool will remain in the pool before they are closed/recycled. That problem you are having is most likely that you are not closing your connections after use.

修复代码以在完成连接时关闭连接,关闭连接将会释放它回到连接池,以便它们可以重用。

Fix your code to close connections when you are done with them, closing a connection will release it back to the connection pool so they are available for reuse.

有些连接池在连接可以使用时会有额外的超时,强制连接返回在那之后游泳池。该连接的用户看起来好像连接已关闭。我不认为玻璃鱼池有这个选项。

Some connection pools have additional timeouts for the time a connection can be used, forcing the connection back in the pool after that time. Which to the user of that connection will look as if the connection has been closed. I don't think the glassfish pool has this option though.

这篇关于数据库连接在glassfish空闲超时后不会释放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆