## com.sun.grizzly.util
Class ThreadAttachment

    java.lang.Object
      com.sun.grizzly.util.SelectionKeyAttachment
          com.sun.grizzly.util.SelectionKeyActionAttachment
              com.sun.grizzly.util.ThreadAttachment

All Implemented Interfaces:
  AttributeHolder

    public class ThreadAttachment

extends SelectionKeyActionAttachment
implements AttributeHolder

This object represent the state of a `WorkerThread`. This include the ByteBuffer binded to the WorkerThread, application data etc.

Author:
  Jeanfrancois Arcand, Alexey Stashok

Nested Class Summary
`static class` `ThreadAttachment.Mode`

Constructor Summary
`ThreadAttachment()`

Method Summary
`void` `associate()` Associates ThreadAttachment with the current thread
`void` `deassociate()` Releases ThreadAttachment association with the current thread
`Object` `getAttribute(String key)` Return an object based on a name.
`Map<String,Object>` `getAttributes()` Return a `Map` of attribute name/value pairs.
`ByteBuffer` `getByteBuffer()` Return the `ByteBuffer` shared this thread
`ByteBuffer` `getInputBB()` Return the encrypted `ByteBuffer` used to handle request.
`int` `getMode()`
`ByteBuffer` `getOutputBB()` Return the encrypted `ByteBuffer` used to handle response.
`SSLEngine` `getSSLEngine()` Set the`SSLEngine`.
`String` `getThreadId()` Return the name of the Thread on which this instance is binded.
`void` `postProcess(SelectionKey selectionKey)` SelectionKey attachment postProcessing
`void` `process(SelectionKey selectionKey)` SelectionKey attachment processing
`void` `release(SelectionKey selectionKey)`
`Object` `removeAttribute(String key)` Remove a name/value object.
`void` `reset()`
`void` `setAttribute(String key, Object value)` Set a name/value object.
`void` `setAttributes(Map<String,Object> attributes)` Set a `Map` of attribute name/value pairs.
`void` `setByteBuffer(ByteBuffer byteBuffer)` Set the `ByteBuffer` shared this thread
`void` `setInputBB(ByteBuffer inputBB)` Set the encrypted `ByteBuffer` used to handle request.
`void` `setMode(int mode)`
`void` `setOutputBB(ByteBuffer outputBB)` Set the encrypted `ByteBuffer` used to handle response.
`void` `setSSLEngine(SSLEngine sslEngine)` Get the`SSLEngine`.
`void` `setThreadId(String threadId)` Set the Thread's name on which this instance is binded.

Methods inherited from class com.sun.grizzly.util.SelectionKeyAttachment
`getAttachment, getTimeout, setTimeout`

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

Constructor Detail

### ThreadAttachment

    public ThreadAttachment()

Method Detail

### getMode

    public int getMode()

### setMode

    public void setMode(int mode)

### setAttribute

    public void setAttribute(String key,
                             Object value)

  Description copied from interface: `AttributeHolder`
  Set a name/value object.

  Specified by:
    `setAttribute` in interface `AttributeHolder`
  Parameters:
    `key` - - name of an attribute
    `value` - - value of named attribute

### getAttribute

    public Object getAttribute(String key)

  Description copied from interface: `AttributeHolder`
  Return an object based on a name.

  Specified by:
    `getAttribute` in interface `AttributeHolder`
  Parameters:
    `key` - - name of an attribute
  Returns:
    - attribute value for the `name`, null if `name` does not exist in `attributes`

### removeAttribute

    public Object removeAttribute(String key)

  Description copied from interface: `AttributeHolder`
  Remove a name/value object.

  Specified by:
    `removeAttribute` in interface `AttributeHolder`
  Parameters:
    `key` - - name of an attribute
  Returns:
    attribute which has been removed

### setAttributes

    public void setAttributes(Map<String,Object> attributes)

  Description copied from interface: `AttributeHolder`
  Set a `Map` of attribute name/value pairs. Old `AttributeHolder` values will not be available. Later changes of this `Map` will lead to changes to the current `AttributeHolder`.

  Specified by:
    `setAttributes` in interface `AttributeHolder`
  Parameters:
    `attributes` - - map of name/value pairs

### getAttributes

    public Map<String,Object> getAttributes()

  Description copied from interface: `AttributeHolder`
  Return a `Map` of attribute name/value pairs. Updates, performed on the returned `Map` will be reflected in this `AttributeHolder`

  Specified by:
    `getAttributes` in interface `AttributeHolder`
  Returns:
    - `Map` of attribute name/value pairs

### setByteBuffer

    public void setByteBuffer(ByteBuffer byteBuffer)

  Set the `ByteBuffer` shared this thread

### getByteBuffer

    public ByteBuffer getByteBuffer()

  Return the `ByteBuffer` shared this thread

### getInputBB

    public ByteBuffer getInputBB()

  Return the encrypted `ByteBuffer` used to handle request.

  Returns:
    `ByteBuffer`

### setInputBB

    public void setInputBB(ByteBuffer inputBB)

  Set the encrypted `ByteBuffer` used to handle request.

  Parameters:
    `inputBB` - `ByteBuffer`

### getOutputBB

    public ByteBuffer getOutputBB()

  Return the encrypted `ByteBuffer` used to handle response.

  Returns:
    `ByteBuffer`

### setOutputBB

    public void setOutputBB(ByteBuffer outputBB)

  Set the encrypted `ByteBuffer` used to handle response.

  Parameters:
    `outputBB` - `ByteBuffer`

### getSSLEngine

    public SSLEngine getSSLEngine()

  Set the`SSLEngine`.

### setSSLEngine

    public void setSSLEngine(SSLEngine sslEngine)

  Get the`SSLEngine`.

  Parameters:
    `sslEngine{@link` - SSLEngine}

### getThreadId

    public String getThreadId()

  Return the name of the Thread on which this instance is binded.

### setThreadId

    public void setThreadId(String threadId)

  Set the Thread's name on which this instance is binded.

### associate

    public void associate()

  Associates ThreadAttachment with the current thread

### deassociate

    public void deassociate()

  Releases ThreadAttachment association with the current thread

### process

    public void process(SelectionKey selectionKey)

  SelectionKey attachment processing

  Specified by:
    `process` in class `SelectionKeyActionAttachment`
  Parameters:
    `selectionKey` -

### postProcess

    public void postProcess(SelectionKey selectionKey)

  SelectionKey attachment postProcessing

  Specified by:
    `postProcess` in class `SelectionKeyActionAttachment`
  Parameters:
    `selectionKey` -

### reset

    public void reset()

### release

    public void release(SelectionKey selectionKey)

  Overrides:
    `release` in class `SelectionKeyAttachment`

Copyright © 2008 SUN Microsystems. All Rights Reserved.