Class IORequest
Class ChannelGroup's non-blocking sendNoWait()
method
includes an IORequest argument. This allows the caller to initiate the send
operation and continue processing while the channel group sends the message
in a separate thread. To wait for the message to be sent, the caller must
call the IORequest object's waitForFinish()
method.
Class ChannelGroup's non-blocking receiveNoWait()
method includes an IORequest argument. This allows the caller to initiate the
receive operation and continue processing while the channel group receives
the message in a separate thread. To wait for the message to be received, the
caller must call the IORequest object's waitForFinish()
method,
which returns a Status object giving the results of the receive
operation.
- Version:
- 12-Oct-2008
- Author:
- Alan Kaminsky
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Determine if this I/O request has finished.protected void
reportFailure
(IOException theIOException) Report that this I/O request failed with an I/O exception.protected void
Report that this I/O request succeeded.toString()
Returns a string version of this I/O request.Wait until the send or receive operation corresponding to this I/O request has finished.
-
Field Details
-
myChannel
Channel on which to send or receive message. Null means "any channel" (only valid for receiving). -
myTagLb
protected int myTagLbMessage tag range lower bound. For sending, myTagLb gives the outgoing message tag, and myTagUb is not used. For receiving, an incoming message tag in the range myTagLb..myTabUb inclusive will match this I/O request. -
myTagUb
protected int myTagUbMessage tag range upper bound. -
myBuf
Source or destination of message items. -
myStatus
Status of a received message.
-
-
Constructor Details
-
IORequest
public IORequest()Construct a new I/O request object.
-
-
Method Details
-
isFinished
Determine if this I/O request has finished.- Returns:
- False if this I/O request has not finished, true if this I/O request has finished successfully.
- Throws:
IOException
- Thrown if this I/O request has finished and an I/O error occurred.IOException
- if any.
-
waitForFinish
Wait until the send or receive operation corresponding to this I/O request has finished. For a receive operation, a Status object containing the results of the receive operation is returned; for a send operation, null is returned.- Returns:
- Receive status for a receive operation, or null for a send operation.
- Throws:
IOException
- Thrown if an I/O error occurred.IOException
- if any.
-
toString
Returns a string version of this I/O request. -
reportSuccess
protected void reportSuccess()Report that this I/O request succeeded. -
reportFailure
Report that this I/O request failed with an I/O exception.- Parameters:
theIOException
- I/O exception.
-