org.glassfish.grizzly
Class Context

java.lang.Object
  extended by org.glassfish.grizzly.Context
All Implemented Interfaces:
AttributeStorage, Cacheable

public class Context
extends Object
implements AttributeStorage, Cacheable

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

Author:
Alexey Stashok

Constructor Summary
Context()
           
 
Method Summary
static Context create(Connection connection)
           
static Context create(Connection connection, Processor processor, IOEvent ioEvent)
           
 AttributeHolder getAttributes()
          Get attributes (AttributeHolder), associated with the processing Context.
 Connection getConnection()
          Get the processing Connection.
 IOEvent getIoEvent()
          Get the processing IOEvent.
 PostProcessor getPostProcessor()
           
 Processor getProcessor()
          Get the Processor, which is responsible to process the IOEvent.
 void recycle()
          Recycle this Context
 void reset()
          If implementation uses ObjectPool to store and reuse Context instances - this method will be called before Context will be offered to pool.
 void setConnection(Connection connection)
          Set the processing Connection.
 void setIoEvent(IOEvent ioEvent)
          Set the processing IOEvent.
 void setPostProcessor(PostProcessor postProcessor)
           
 void setProcessor(Processor processor)
          Set the Processor, which is responsible to process the IOEvent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Context

public Context()
Method Detail

create

public static Context create(Connection connection)

create

public static Context create(Connection connection,
                             Processor processor,
                             IOEvent ioEvent)

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.

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()

setPostProcessor

public void setPostProcessor(PostProcessor postProcessor)

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.

Specified by:
getAttributes in interface AttributeStorage
Returns:
attributes (AttributeHolder), associated with the processing Context.

reset

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


recycle

public void recycle()
Recycle this Context

Specified by:
recycle in interface Cacheable


Copyright © 2011 Oracle Corpration. All Rights Reserved.