Hi Tomasz,
>
> 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?
>
Yes.
> 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)?
>
Current cacheable implementation doesn't have mechanism to figure out,
whether the connection is closed before it actually tries to use it.
You're right, extending the ConnectionFinder could help here to write
smarter logic.
Let me know if you'll have more questions or if you'll have the
implementation ready - it could be interesting to take a look at it.
Thank you.
WBR,
Alexey.
>
> I will greatly appreciate any help.
>
>
>
> Thanks,
>
> Tomasz Kowalczewski
>