com.sun.grizzly
Class Context

java.lang.Object
  extended by com.sun.grizzly.Context
All Implemented Interfaces:
PoolableObject
Direct Known Subclasses:
FilterChainContext

public class Context
extends Object
implements PoolableObject

Object, which is responsible for holding context during I/O event processing.

Author:
Alexey Stashok

Constructor Summary
Context()
           
Context(ObjectPool parentPool)
           
 
Method Summary
 AttributeHolder getAttributes()
          Get attributes (AttributeHolder), associated with the processing Context.
 Connection getConnection()
          Get the processing Connection.
 IOEvent getIoEvent()
          Get the processing IOEvent.
 PostProcessor getPostProcessor()
          Get the PostProcessor, which will be called after Processor will finish its execution to finish IOEvent processing.
 Processor getProcessor()
          Get the Processor, which is responsible to process the IOEvent.
 ProcessorRunnable getProcessorRunnable()
          Get the ProcessorRunnable task instance.
protected  AttributeHolder initializeAttributeHolder()
           
 AttributeHolder obtainAttributes()
          Get attributes (AttributeHolder), associated with the processing Context.
 void offerToPool()
          Return this Context to the ObjectPool it was taken from.
 void prepare()
          If implementation uses ObjectPool to store and reuse Context instances - this method will be called before Context will be polled from pool.
 void release()
          If implementation uses ObjectPool to store and reuse Context instances - this method will be called before Context will be offered to pool.
protected  void setAttributes(AttributeHolder attributes)
           
 void setConnection(Connection connection)
          Set the processing Connection.
 void setIoEvent(IOEvent ioEvent)
          Set the processing IOEvent.
 void setPostProcessor(PostProcessor ioEventPostProcessor)
          Set the PostProcessor, which will be called after Processor will finish its execution to finish IOEvent processing.
 void setProcessor(Processor processor)
          Set the Processor, which is responsible to process the IOEvent.
 void setProcessorRunnable(ProcessorRunnable processorRunnable)
          Set the ProcessorRunnable task instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Context

public Context()

Context

public Context(ObjectPool parentPool)
Method Detail

getIoEvent

public IOEvent getIoEvent()
Get the processing IOEvent.

Returns:
the processing IOEvent.

setIoEvent

public void setIoEvent(IOEvent ioEvent)
Set the processing IOEvent.

Parameters:
ioEvent - the processing IOEvent.

getConnection

public Connection getConnection()
Get the processing Connection.

Returns:
the processing Connection.

setConnection

public void setConnection(Connection connection)
Set the processing Connection.

Parameters:
connection - the processing Connection.

getProcessorRunnable

public ProcessorRunnable getProcessorRunnable()
Get the ProcessorRunnable task instance.

Returns:
the ProcessorRunnable task instance.

setProcessorRunnable

public void setProcessorRunnable(ProcessorRunnable processorRunnable)
Set the ProcessorRunnable task instance.

Parameters:
processorRunnable - the ProcessorRunnable task instance.

getProcessor

public Processor getProcessor()
Get the Processor, which is responsible to process the IOEvent.

Returns:
the Processor, which is responsible to process the IOEvent.

setProcessor

public void setProcessor(Processor processor)
Set the Processor, which is responsible to process the IOEvent.

Parameters:
processor - the Processor, which is responsible to process the IOEvent.

getPostProcessor

public PostProcessor getPostProcessor()
Get the PostProcessor, which will be called after Processor will finish its execution to finish IOEvent processing.

Returns:
the PostProcessor, which will be called after Processor will finish its execution to finish IOEvent processing.

setPostProcessor

public void setPostProcessor(PostProcessor ioEventPostProcessor)
Set the PostProcessor, which will be called after Processor will finish its execution to finish IOEvent processing.

Parameters:
ioEventPostProcessor - the PostProcessor, which will be called after Processor will finish its execution to finish IOEvent processing.

getAttributes

public AttributeHolder getAttributes()
Get attributes (AttributeHolder), associated with the processing Context. AttributeHolder is cleared after each I/O event processing. Method may return null, if there were no attributes added before.

Returns:
attributes (AttributeHolder), associated with the processing Context.

obtainAttributes

public AttributeHolder obtainAttributes()
Get attributes (AttributeHolder), associated with the processing Context. AttributeHolder is cleared after each I/O event processing. Method will always returns non-null AttributeHolder.

Returns:
attributes (AttributeHolder), associated with the processing Context.

initializeAttributeHolder

protected AttributeHolder initializeAttributeHolder()

setAttributes

protected void setAttributes(AttributeHolder attributes)

prepare

public void prepare()
If implementation uses ObjectPool to store and reuse Context instances - this method will be called before Context will be polled from pool.

Specified by:
prepare in interface PoolableObject

release

public void release()
If implementation uses ObjectPool to store and reuse Context instances - this method will be called before Context will be offered to pool.

Specified by:
release in interface PoolableObject

offerToPool

public void offerToPool()
Return this Context to the ObjectPool it was taken from.



Copyright © 2009 SUN Microsystems. All Rights Reserved.