|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.AbstractWriter<SocketAddress>
org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter
public abstract class AbstractNIOAsyncQueueWriter
The AsyncQueueWriter implementation, based on the Java NIO
| Field Summary | |
|---|---|
protected NIOTransport |
transport
|
| Fields inherited from interface org.glassfish.grizzly.asyncqueue.AsyncQueueProcessor |
|---|
NOT_REGISTER_KEY |
| Constructor Summary | |
|---|---|
AbstractNIOAsyncQueueWriter(NIOTransport transport)
|
|
| Method Summary | ||
|---|---|---|
void |
close()
Close AsyncQueueProcessor and release associated resources |
|
protected
|
doWrite(Connection connection,
WriteResult currentResult,
CompletionHandler completionHandler,
SocketAddress dstAddress,
Buffer buffer)
Performs real write on the NIO channel |
|
protected void |
failWriteRecord(Connection connection,
AsyncWriteQueueRecord record,
Throwable e)
|
|
ObjectPool |
getContextPool()
|
|
boolean |
isInterested(IOEvent ioEvent)
Is this Processor interested in processing the i/o event |
|
boolean |
isReady(Connection connection)
Checks whether there is ready data in AsyncQueue,
associated with the Connection. |
|
void |
onClose(Connection connection)
Callback method, which is called, when Connection has been closed,
to let processor release a connection associated resources. |
|
protected abstract void |
onReadyToWrite(Connection connection)
|
|
protected void |
onWriteCompleted(Connection connection,
AsyncWriteQueueRecord<?> record)
|
|
protected void |
onWriteFailure(Connection connection,
AsyncWriteQueueRecord failedRecord,
IOException e)
|
|
protected void |
onWriteIncompleted(Connection connection,
AsyncWriteQueueRecord<?> record)
|
|
ProcessorResult |
process(Context context)
Method will be called by framework to process some event, which occured on a connection |
|
void |
processAsync(Connection connection)
Callback method, which is called async. |
|
void |
setInterested(IOEvent ioEvent,
boolean isInterested)
Set the the i/o event, this Processor is interested in |
|
Future<WriteResult<Buffer,SocketAddress>> |
write(Connection connection,
SocketAddress dstAddress,
Buffer buffer,
CompletionHandler<WriteResult<Buffer,SocketAddress>> completionHandler,
Interceptor<WriteResult> interceptor)
Method writes the buffer to the specific address. |
|
Future<WriteResult<Buffer,SocketAddress>> |
write(Connection connection,
SocketAddress dstAddress,
Buffer buffer,
CompletionHandler<WriteResult<Buffer,SocketAddress>> completionHandler,
Interceptor<WriteResult> interceptor,
MessageCloner<Buffer> cloner)
Method writes the Buffer to the specific address. |
|
protected abstract int |
write0(Connection connection,
SocketAddress dstAddress,
Buffer buffer,
WriteResult<Buffer,SocketAddress> currentResult)
|
|
| Methods inherited from class org.glassfish.grizzly.AbstractWriter |
|---|
write, write, write, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.glassfish.grizzly.Writer |
|---|
write, write, write, write, write |
| Methods inherited from interface org.glassfish.grizzly.Processor |
|---|
afterProcess, beforeProcess, context |
| Field Detail |
|---|
protected NIOTransport transport
| Constructor Detail |
|---|
public AbstractNIOAsyncQueueWriter(NIOTransport transport)
| Method Detail |
|---|
public Future<WriteResult<Buffer,SocketAddress>> write(Connection connection,
SocketAddress dstAddress,
Buffer buffer,
CompletionHandler<WriteResult<Buffer,SocketAddress>> completionHandler,
Interceptor<WriteResult> interceptor)
throws IOException
write in interface Writer<SocketAddress>connection - the Connection to write todstAddress - the destination address the buffer will be
sent tobuffer - the buffer, from which the data will be writtencompletionHandler - CompletionHandler,
which will get notified, when write will be completedinterceptor - Interceptor, which will be able to intercept
control each time new portion of a data was written from a
buffer.
The interceptor can decide, whether asynchronous write is
completed or not, or provide other processing instructions.
Future, using which it's possible to check the
result
IOException
public Future<WriteResult<Buffer,SocketAddress>> write(Connection connection,
SocketAddress dstAddress,
Buffer buffer,
CompletionHandler<WriteResult<Buffer,SocketAddress>> completionHandler,
Interceptor<WriteResult> interceptor,
MessageCloner<Buffer> cloner)
throws IOException
Buffer to the specific address.
write in interface AsyncQueueWriter<SocketAddress>connection - the Connection to write todstAddress - the destination address the message will be
sent tobuffer - the message, from which the data will be writtencompletionHandler - CompletionHandler,
which will get notified, when write will be completedinterceptor - Interceptor, which will be able to intercept
control each time new portion of a data was written from a
buffer.
The interceptor can decide, whether asynchronous write is
completed or not, or provide other processing instructions.cloner - MessageCloner, which will be invoked by
AsyncQueueWriter, if message could not be written to a
channel directly and has to be put on a asynchronous queue
Future, using which it's possible to check the
result
IOExceptionpublic boolean isReady(Connection connection)
AsyncQueue,
associated with the Connection.
isReady in interface AsyncQueueProcessorconnection - Connection
public void processAsync(Connection connection)
throws IOException
AsyncQueue, which are associated with the given
Connection
processAsync in interface AsyncQueueProcessorconnection - Connection
IOExceptionpublic void onClose(Connection connection)
Connection has been closed,
to let processor release a connection associated resources.
onClose in interface AsyncQueueProcessorconnection - Connectionpublic ObjectPool getContextPool()
public boolean isInterested(IOEvent ioEvent)
Processor interested in processing the i/o event
isInterested in interface ProcessorProcessor is interested and execution
process will start, false otherwise.
public ProcessorResult process(Context context)
throws IOException
process in interface Processorcontext - processing context
IOException
public void setInterested(IOEvent ioEvent,
boolean isInterested)
Processor is interested in
setInterested in interface ProcessorioEvent - IOEventisInterested - true, if Processor is interested in
processing of the I/O event, or false otherwise.public void close()
close in interface AsyncQueueProcessor
protected <E> void doWrite(Connection connection,
WriteResult currentResult,
CompletionHandler completionHandler,
SocketAddress dstAddress,
Buffer buffer)
throws IOException
connection - the Connection to write tocurrentResult - current result of the write operationdstAddress - destination addressmessage - the message to writewritePreProcessor - write post-processor
IOException
protected void onWriteCompleted(Connection connection,
AsyncWriteQueueRecord<?> record)
throws IOException
IOException
protected void onWriteIncompleted(Connection connection,
AsyncWriteQueueRecord<?> record)
throws IOException
IOException
protected void onWriteFailure(Connection connection,
AsyncWriteQueueRecord failedRecord,
IOException e)
protected void failWriteRecord(Connection connection,
AsyncWriteQueueRecord record,
Throwable e)
protected abstract int write0(Connection connection,
SocketAddress dstAddress,
Buffer buffer,
WriteResult<Buffer,SocketAddress> currentResult)
throws IOException
IOException
protected abstract void onReadyToWrite(Connection connection)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||