users@grizzly.java.net

CacheableConnectorHandlerPool and broken connections

From: Tomasz Kowalczewski <tomasz.kowalczewski_at_gmail.com>
Date: Wed, 8 Oct 2008 15:49:27 +0200

Hi All,



I have problem when using CacheableConnectorHandlerPool on the client side.
When doing:


ConnectorHandler connector = controller.acquireConnectorHandler(
Protocol.TCP );
CallbackHandler callback = new ...

connector.connect( address, callback );


I do get sometimes ClosedChannelException. The partial stack trace is:


java.nio.channels.ClosedChannelException
    at java.nio.channels.spi.AbstractSelectableChannel.register(Unknown
Source)
    at java.nio.channels.SelectableChannel.register(Unknown Source)
    at
com.sun.grizzly.connectioncache.client.CacheableConnectorHandler.notifyCallbackHandlerPseudoConnect(CacheableConnectorHandler.java:265)
    at
com.sun.grizzly.connectioncache.client.CacheableConnectorHandler.doConnect(CacheableConnectorHandler.java:161)
    at
com.sun.grizzly.connectioncache.client.CacheableConnectorHandler.connect(CacheableConnectorHandler.java:97)

    at [here is the call to method containing connect()]


As I understand, what happens is that the connection is closed by the
server, but the pool is not aware of it. Is that possible? Does the
CacheableConnectorHandlerPool
handle such events in any way? Or maybe I should handle closed connections
(connector handlers) using ConnectionFinder class (before creating/returning
new connection)?


I will greatly appreciate any help.


Thanks,

Tomasz Kowalczewski