org.glassfish.grizzly
Interface Processor<E extends Context>

All Known Subinterfaces:
AsyncQueueProcessor, AsyncQueueReader<L>, AsyncQueueWriter<L>, CallbackHandler, FilterChain
All Known Implementing Classes:
AbstractCallbackHandler, AbstractFilterChain, AbstractNIOAsyncQueueReader, AbstractNIOAsyncQueueWriter, AbstractProcessor, CallbackHandlerAdapter, DefaultFilterChain, ListFacadeFilterChain, ProcessorWrapper, StandaloneProcessor, TCPNIOAsyncQueueReader, TCPNIOAsyncQueueWriter, TCPNIOConnectorHandler.ConnectorEventProcessor, TCPNIOServerConnection.AcceptorEventProcessor, UDPNIOAsyncQueueReader, UDPNIOAsyncQueueWriter

public interface Processor<E extends Context>

Processor implementations are responsible for processing I/O events, which occur on connection.

Author:
Alexey Stashok

Method Summary
 void afterProcess(E context)
          Method will be called by framework after Processor execution, so it can release associated resources.
 void beforeProcess(E context)
          Method will be called by framework before executing this Processor.
 E context()
          Creates Context
 boolean isInterested(IOEvent ioEvent)
          Is this Processor interested in processing the i/o event
 ProcessorResult process(E context)
          Method will be called by framework to process some event, which occured on a connection
 void setInterested(IOEvent ioEvent, boolean isInterested)
          Set the the i/o event, this Processor is interested in
 

Method Detail

context

E context()
Creates Context

Returns:
Context, or null, if default Context could be used.

beforeProcess

void beforeProcess(E context)
                   throws IOException
Method will be called by framework before executing this Processor.

Parameters:
context - processing context
Throws:
IOException

process

ProcessorResult process(E context)
                        throws IOException
Method will be called by framework to process some event, which occured on a connection

Parameters:
context - processing context
Returns:
the result of I/O event processing
Throws:
IOException

afterProcess

void afterProcess(E context)
                  throws IOException
Method will be called by framework after Processor execution, so it can release associated resources.

Parameters:
context - processing context
Throws:
IOException

isInterested

boolean isInterested(IOEvent ioEvent)
Is this Processor interested in processing the i/o event

Parameters:
ioEvent -
Returns:
true, if this Processor is interested and execution process will start, false otherwise.

setInterested

void setInterested(IOEvent ioEvent,
                   boolean isInterested)
Set the the i/o event, this Processor is interested in

Parameters:
ioEvent - IOEvent
isInterested - true, if Processor is interested in processing of the I/O event, or false otherwise.


Copyright © 2009 SUN Microsystems. All Rights Reserved.