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

All Known Subinterfaces:
FilterChain
All Known Implementing Classes:
AbstractFilterChain, DefaultFilterChain, ListFacadeFilterChain, StandaloneProcessor

public interface Processor<E extends Context>

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

Author:
Alexey Stashok

Method Summary
 boolean isInterested(IOEvent ioEvent)
          Is this Processor interested in processing the i/o event
 E obtainContext(Connection connection)
          Creates Context
 ProcessorResult process(E context)
          Method will be called by framework to process some event, which occurred on a connection
 GrizzlyFuture<ReadResult> read(Connection connection, CompletionHandler<ReadResult> completionHandler)
           
 void setInterested(IOEvent ioEvent, boolean isInterested)
          Set the the i/o event, this Processor is interested in
 GrizzlyFuture<WriteResult> write(Connection connection, java.lang.Object dstAddress, java.lang.Object message, CompletionHandler<WriteResult> completionHandler)
           
 

Method Detail

obtainContext

E obtainContext(Connection connection)
Creates Context

Parameters:
connection - Connection to obtain processor for.
Returns:
Context, or null, if default Context could be used.

process

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

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

read

GrizzlyFuture<ReadResult> read(Connection connection,
                               CompletionHandler<ReadResult> completionHandler)
                               throws java.io.IOException
Throws:
java.io.IOException

write

GrizzlyFuture<WriteResult> write(Connection connection,
                                 java.lang.Object dstAddress,
                                 java.lang.Object message,
                                 CompletionHandler<WriteResult> completionHandler)
                                 throws java.io.IOException
Throws:
java.io.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 © 2011 Oracle Corpration. All Rights Reserved.