如何在Java类中创建确定仍然打开多少连接的方法 [英] How to create a method in java class that determine how many connection are still open

查看:84
本文介绍了如何在Java类中创建确定仍然打开多少连接的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Java类中创建确定仍然打开多少连接以及它们在做什么的方法?我正在尝试创建一个类来管理连接池.

谢谢:)

How to create a method in java class that determine how many connection are still open and what they are doing? I''m trying to create a class to manage connection pool.

Thank you :)

推荐答案

这可能不是最好的方法.
让连接知道它是否仍处于活动状态,然后池类可以检查连接是否空闲,并在需要时将其收回.

此处重新阅读我之前对您的回复 [
This is probably not the best approach.
Allow the connection to know if it is still active and then the pool class can check if connections are idle and take them back if needed.

Re-read my earlier response to you here[^].


这篇关于如何在Java类中创建确定仍然打开多少连接的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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