|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
interface AsyncKey
A token handed out by an AsyncGroupImpl to support asynchronous
IO operations on an underlying SelectableChannel.
It is similar in function to the SelectionKey in non-blocking
reactive IO.
| Method Summary | ||
|---|---|---|
SelectableChannel |
channel()
Returns the underlying SelectableChannel for this key. |
|
void |
close()
Closes this key's underlying channel. |
|
|
execute(int op,
A attachment,
CompletionHandler<R,? super A> handler,
long timeout,
TimeUnit unit,
Callable<R> callable)
Initiates the given operation asynchronously on the underlying channel, and returns a future representing the result. |
|
void |
execute(Runnable command)
Executes the given command according to the execution policy determined by this key and channel group. |
|
boolean |
isOpPending(int op)
Returns whether the given operation is pending. |
|
|
runCompletion(CompletionHandler<R,A> handler,
A attachment,
Future<R> future)
Invokes the given completion handler, if it is not null;
otherwise does nothing. |
|
void |
selected(int readyOps)
Notifies this key that the given IO operations are ready on the underlying channel. |
|
| Method Detail |
|---|
SelectableChannel channel()
SelectableChannel for this key.
SelectableChannel for this keyboolean isOpPending(int op)
op - a SelectionKey opcode
true if the operation is pendingvoid selected(int readyOps)
readyOps - the SelectionKey ops that are readyvoid execute(Runnable command)
select().
execute in interface Executorcommand - the command to run, possibly in another thread
<R,A> void runCompletion(CompletionHandler<R,A> handler,
A attachment,
Future<R> future)
null;
otherwise does nothing.
Passes the handler an IoFuture constructed from the given
future and attachment object.
R - the result typeA - the attachment typehandler - the completion handlerattachment - the attachment, or nullfuture - the result
<R,A> IoFuture<R,A> execute(int op,
A attachment,
CompletionHandler<R,? super A> handler,
long timeout,
TimeUnit unit,
Callable<R> callable)
null completion handler is
provided, it will be invoked when the operation completes.
R - the result typeA - the attachment typeop - a SelectionKey opcodeattachment - the attachment for the IoFuture; may be
nullhandler - the completion handler; may be nulltimeout - the timeout for this operation, or 0 to wait
indefinitelyunit - the unit of the timeoutcallable - performs an IO operation on the underlying channel
when invoked
ClosedAsynchronousChannelException - if the channel is closed
ReadPendingException - if OP_READ is requested but
already pending
WritePendingException - if OP_WRITE is requested but
already pending
ConnectionPendingException - OP_CONNECT is requested
but already pending
AcceptPendingException - if OP_ACCEPT is requested but
already pendingCompletionHandler,
AsynchronousChannel
void close()
throws IOException
[Description copied from AsynchronousChannel.close()]
Any outstanding asynchronous operations upon this channel will
complete by throwing ExecutionException with cause
AsynchronousCloseException.
This method otherwise behaves exactly as specified by the
Channel interface.
close in interface CloseableIOException - if an I/O error occurs
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||