dev@grizzly.java.net

Re: A question about outbound connection cache

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Mon, 16 Feb 2009 10:44:16 +0100

Hi,

>
> I have a question about outbound connection cahce implementation.
>
> http://blogs.sun.com/oleksiys/entry/connection_management_cache_in_grizzly
>
>
> I have tested it and it works fine in most cases. But sometimes it
> caused unexpected
> results. I am trying to understand the source code regarding this
> feature, and I
> foud out the point which may cause the problem.
>
> In OutboundConnectionCacheBlockingImpl, there is a HashMap called
> entryMap
> whose key is ContactInfo(actually it is a CacheableConnectorHandler).
Hmm, AFAIR it should not be CacheableConnectorHandler in HashMap, but
some real TCP or UDP ConnectorHandler.
Can you pls. provide more details on this issue and some links to the
code?

Thank you very much.

WBR,
Alexey.


> According to the pseudo code on the above URL, I can get
> CacheableConnectorHandler
> by calling Controller.acquireConnectorHandler and can release the
> handler by calling
> Controller.releaseConnectorHandler. If CacheableConnectorHandler is
> put back
> to CacheableConnectorHandler pool, it will bes reused, and IMHO, it
> may cause
> unexpected results.
>
> That is because if CacheableConnectorHandler is reused,
> targetAddress field is
> rewritten, and it is a part of hashCode() (also used in equals()
> method). So, it is
> possible that hash code of the key is changed after putting the
> value in
> the entryMap.
>
>
> Minoru
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>