Package edu.rit.mp

Class IORequest

java.lang.Object
edu.rit.mp.IORequest

public class IORequest extends Object
Class IORequest encapsulates the state of a message being sent or received in the Message Protocol (MP).

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

    Fields
    Modifier and Type
    Field
    Description
    protected Buf
    Source or destination of message items.
    protected Channel
    Channel on which to send or receive message.
    protected Status
    Status of a received message.
    protected int
    Message tag range lower bound.
    protected int
    Message tag range upper bound.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a new I/O request object.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    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.
    Returns a string version of this I/O request.
    Wait until the send or receive operation corresponding to this I/O request has finished.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • myChannel

      protected Channel myChannel
      Channel on which to send or receive message. Null means "any channel" (only valid for receiving).
    • myTagLb

      protected int myTagLb
      Message 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 myTagUb
      Message tag range upper bound.
    • myBuf

      protected Buf myBuf
      Source or destination of message items.
    • myStatus

      protected Status myStatus
      Status of a received message.
  • Constructor Details

    • IORequest

      public IORequest()
      Construct a new I/O request object.
  • Method Details

    • isFinished

      public boolean isFinished() throws IOException
      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

      public Status waitForFinish() throws IOException
      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

      public String toString()
      Returns a string version of this I/O request.
      Overrides:
      toString in class Object
      Returns:
      String version.
    • reportSuccess

      protected void reportSuccess()
      Report that this I/O request succeeded.
    • reportFailure

      protected void reportFailure(IOException theIOException)
      Report that this I/O request failed with an I/O exception.
      Parameters:
      theIOException - I/O exception.