Erik Svensson wrote:
> A question here:
>
> In DefaultProtocolChainInstanceHandler
> the method poll looks like:
>
> public ProtocolChain poll() {
> ProtocolChain protocolChain = protocolChains.poll();
> if (protocolChain == null){
> protocolChain = new DefaultProtocolChain();
> }
> return protocolChain;
> }
>
> Should there be a 'offer(protocolChain)' here?
>
> public ProtocolChain poll() {
> ProtocolChain protocolChain = protocolChains.poll();
> if (protocolChain == null){
> protocolChain = new DefaultProtocolChain();
> // PATCH
> offer(protocolChain);
> // END PATCH
> }
> return protocolChain;
> }
>
> Otherwise a new protocolchain will be created everytime poll is called
> unless one is manually added through offer.
The contract here is when you do poll, you also invoke the
DefaultProtocolChainInstanceHandler.offer() method. But you found a bug
in Grizzly as the offer method is never called!!
Originally, the offer() method was called...looks like we lost it
between 1.5.x and 1.7.1! Let me re-add it so your stuff can work. Now
Your patch will not work as two thread might ends up with the same
protocol chain, and since the protocol chain are stateful, we will get
data corruption.
Thanks!
-- Jeanfrancois
>
> cheers
>
> Erik Svensson, SIX AB
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>