Class Proxy

java.lang.Object
edu.rit.pj.cluster.Proxy
Direct Known Subclasses:
JobBackendProxy, JobFrontendProxy, JobSchedulerProxy

public abstract class Proxy extends Object
Class Proxy is the abstract base class for a proxy object for sending messages to a PJ process.
Version:
20-Nov-2006
Author:
Alan Kaminsky
  • Constructor Summary

    Constructors
    Constructor
    Description
    Proxy(ChannelGroup theChannelGroup, Channel theChannel)
    Construct a new proxy.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Close communication with this proxy's far end process.
    receive(Buf theDst)
    Receive a message from this proxy's far end process.
    receive(Integer theTag, Buf theDst)
    Receive a message with the given tag from this proxy's far end process.
    void
    send(int theTag, Buf theSrc)
    Send a message with the given tag and items to this proxy's far end process.
    void
    send(Message theMessage)
    Send the given message to this proxy's far end process.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Proxy

      public Proxy(ChannelGroup theChannelGroup, Channel theChannel)
      Construct a new proxy. The proxy will use the given channel in the given channel group to send messages to the far end process.
      Parameters:
      theChannelGroup - Channel group.
      theChannel - Channel.
  • Method Details

    • send

      public void send(Message theMessage) throws IOException
      Send the given message to this proxy's far end process.
      Parameters:
      theMessage - Message.
      Throws:
      IOException - Thrown if an I/O error occurred.
      IOException - if any.
    • send

      public void send(int theTag, Buf theSrc) throws IOException
      Send a message with the given tag and items to this proxy's far end process.
      Parameters:
      theTag - Message tag.
      theSrc - Item source buffer.
      Throws:
      IOException - Thrown if an I/O error occurred.
      IOException - if any.
    • receive

      public Status receive(Buf theDst) throws IOException
      Receive a message from this proxy's far end process. A message will be received from this proxy's channel in this proxy's channel group. The message must have a tag of 0. The message items are stored in the given item destination buffer.

      The receive() method does not return until the message has been fully received.

      Parameters:
      theDst - Item destination buffer.
      Returns:
      Status object giving the outcome of the message reception.
      Throws:
      IOException - Thrown if an I/O error occurred.
      IOException - if any.
    • receive

      public Status receive(Integer theTag, Buf theDst) throws IOException
      Receive a message with the given tag from this proxy's far end process. A message will be received from this proxy's channel in this proxy's channel group. If theTag is null, a message will be received with any tag. The message items are stored in the given item destination buffer.

      The receive() method does not return until the message has been fully received.

      Parameters:
      theTag - Message tag, or null to receive any tag.
      theDst - Item destination buffer.
      Returns:
      Status object giving the outcome of the message reception.
      Throws:
      IOException - Thrown if an I/O error occurred.
      IOException - if any.
    • close

      public void close()
      Close communication with this proxy's far end process.