com.faunos.util.net
Interface HandletContext


public interface HandletContext

An interface provided by a Handlet container to a handlet. By now, this is a familiar pattern seen for example in the servlet or applet specs.

Author:
Babak Farhang
See Also:
Handlet.init(HandletContext)

Method Summary
 void doneProcessing()
          Callback method invoked by a Handlet when it has finished an asynchronous task and is now ready to do I/O.
 ExecutorService executor()
          Returns an executor that the Handlet may use for performing asynchronous tasks.
 boolean processAsynch()
          Returns the container hint as to whether the handlet should try to process non-network I/O tasks asynchronously.
 ByteBuffer workBuffer()
          Returns a temporary work buffer which the Handlet can use to process I/O (typically reads).
 

Method Detail

executor

ExecutorService executor()
Returns an executor that the Handlet may use for performing asynchronous tasks.


doneProcessing

void doneProcessing()
Callback method invoked by a Handlet when it has finished an asynchronous task and is now ready to do I/O. Prior to invoking this method, the Handlet was in the PROCESSING state (and is now in some other state).

See Also:
executor()

workBuffer

ByteBuffer workBuffer()
Returns a temporary work buffer which the Handlet can use to process I/O (typically reads). The returned work buffer may only be used while inside one of the Handlet methods, and then only from the calling thread. The handlet must not hang on to this work work buffer (or a view of it) as it has undefined state outside a handlet method invocation.

Note that successive invocations return the same buffer, but that each invocation clears the state of the returned buffer.

Returns:
a cleared ByteBuffer
See Also:
Buffer.clear()

processAsynch

boolean processAsynch()
Returns the container hint as to whether the handlet should try to process non-network I/O tasks asynchronously.

See Also:
Handlet.state(), IoState.PROCESSING


SourceForge.net Logo