org.glassfish.grizzly
Class StandaloneProcessor

java.lang.Object
  extended by org.glassfish.grizzly.StandaloneProcessor
All Implemented Interfaces:
Processor

public class StandaloneProcessor
extends java.lang.Object
implements Processor

Processor, which is not interested in processing I/O events. Connection lifecycle should be managed explicitly, using read/write/accept/connect methods. This Processor could be set on Connection to avoid it from being processed by FilterChain or other Processor. In this case Connection could be used like regular Java Socket.

Author:
Alexey Stashok

Field Summary
static StandaloneProcessor INSTANCE
           
 
Constructor Summary
StandaloneProcessor()
           
 
Method Summary
 StreamReader getStreamReader(Connection connection)
          Get the Connection StreamReader, to read data from the Connection.
 StreamWriter getStreamWriter(Connection connection)
          Get the Connection StreamWriter, to write data to the Connection.
 boolean isInterested(IOEvent ioEvent)
          StandaloneProcessor is not interested in any IOEvent.
 Context obtainContext(Connection connection)
          Creates Context
 ProcessorResult process(Context context)
          This method should never be called, because isInterested(IOEvent) returns false for any IOEvent.
 GrizzlyFuture read(Connection connection, CompletionHandler completionHandler)
           
 void setInterested(IOEvent ioEvent, boolean isInterested)
          Method does nothing.
 GrizzlyFuture write(Connection connection, java.lang.Object dstAddress, java.lang.Object message, CompletionHandler completionHandler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final StandaloneProcessor INSTANCE
Constructor Detail

StandaloneProcessor

public StandaloneProcessor()
Method Detail

process

public ProcessorResult process(Context context)
                        throws java.io.IOException
This method should never be called, because isInterested(IOEvent) returns false for any IOEvent.

Specified by:
process in interface Processor
Parameters:
context - processing context
Returns:
the result of I/O event processing
Throws:
java.io.IOException

isInterested

public boolean isInterested(IOEvent ioEvent)
StandaloneProcessor is not interested in any IOEvent.

Specified by:
isInterested in interface Processor
Returns:
true, if this Processor is interested and execution process will start, false otherwise.

setInterested

public void setInterested(IOEvent ioEvent,
                          boolean isInterested)
Method does nothing.

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

obtainContext

public Context obtainContext(Connection connection)
Description copied from interface: Processor
Creates Context

Specified by:
obtainContext in interface Processor
Parameters:
connection - Connection to obtain processor for.
Returns:
Context, or null, if default Context could be used.

getStreamReader

public StreamReader getStreamReader(Connection connection)
Get the Connection StreamReader, to read data from the Connection.

Returns:
the Connection StreamReader, to read data from the Connection.

getStreamWriter

public StreamWriter getStreamWriter(Connection connection)
Get the Connection StreamWriter, to write data to the Connection.

Returns:
the Connection StreamWriter, to write data to the Connection.

read

public GrizzlyFuture read(Connection connection,
                          CompletionHandler completionHandler)
                   throws java.io.IOException
Specified by:
read in interface Processor
Throws:
java.io.IOException

write

public GrizzlyFuture write(Connection connection,
                           java.lang.Object dstAddress,
                           java.lang.Object message,
                           CompletionHandler completionHandler)
                    throws java.io.IOException
Specified by:
write in interface Processor
Throws:
java.io.IOException


Copyright © 2011 Oracle Corpration. All Rights Reserved.