我已经在 tomcat 容器中部署了我的 web 应用程序,但由于可能的连接泄漏,web 应用程序不断尝试连接到在端口 11211 和 11212 侦听的本地 memcached 服务器。我正在使用 spy-memcached 客户端。
我定义了一个 ContextListener,它基本上关闭了所有活动的 memcached 客户端连接。
但是,当我取消部署我的网络应用程序时,在我看来,tomcat 仍在尝试继续尝试连接到 memcached 服务器的失败尝试,但它不应该这样做。我已经使用 netstat 检查了 memcached 服务器上的活动 tcp 连接,但我找不到任何条目。
我也重新启动了tomcat服务器,但无济于事。
我应该如何限制 tomcat 建立这些连接?
2011-11-13 21:21:34.575 INFO net.spy.memcached.MemcachedConnection: Reconnecting due to failure to connect to {QA sa=localhost/127.0.0.1:11212, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0}
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:407)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:275)
at net.spy.memcached.MemcachedClient.run(MemcachedClient.java:2030)
2011-11-13 21:21:34.576 WARN net.spy.memcached.MemcachedConnection: Closing, and reopening {QA sa=localhost/127.0.0.1:11212, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0}, attempt 32.