## com.sun.grizzly
Class DefaultProtocolChainInstanceHandler

    java.lang.Object
      com.sun.grizzly.DefaultProtocolChainInstanceHandler

All Implemented Interfaces:
  Handler, ProtocolChainInstanceHandler

    public class DefaultProtocolChainInstanceHandler

extends Object
implements ProtocolChainInstanceHandler

Default implementation of an ProtocolChainInstanceHandler. `ProtocolChain` are cached using a ConcurrentLinkedQueue. When the queue becomes empty, a new instance of `ProtocolChain` is created.

Author:
  Jeanfrancois Arcand

Field Summary
`protected ConcurrentLinkedQueue<ProtocolChain>` `protocolChains` List used to cache instance of ProtocolChain.

Constructor Summary
`DefaultProtocolChainInstanceHandler()`

Method Summary
`boolean` `offer(ProtocolChain protocolChain)` Offer (add) an instance of ProtocolChain to this instance pool.
`ProtocolChain` `poll()` Return a pooled instance of ProtocolChain.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### protocolChains

    protected ConcurrentLinkedQueue<ProtocolChain> protocolChains

  List used to cache instance of ProtocolChain.

Constructor Detail

### DefaultProtocolChainInstanceHandler

    public DefaultProtocolChainInstanceHandler()

Method Detail

### poll

    public ProtocolChain poll()

  Return a pooled instance of ProtocolChain. If the pool is empty, a new instance of ProtocolChain will be returned.

  Specified by:
    `poll` in interface `ProtocolChainInstanceHandler`
  Returns:
    `ProtocolChain`

### offer

    public boolean offer(ProtocolChain protocolChain)

  Offer (add) an instance of ProtocolChain to this instance pool.

  Specified by:
    `offer` in interface `ProtocolChainInstanceHandler`
  Parameters:
    `protocolChain` - - `ProtocolChain` to offer / add to the pool
  Returns:
    boolean, if `ProtocolChain` was successfully added to the pool

Copyright © 2008 SUN Microsystems. All Rights Reserved.