edu.rit.pj.cluster
Class Proxy

java.lang.Object
  extended by 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.


Constructor Summary
Proxy(ChannelGroup theChannelGroup, Channel theChannel)
          Construct a new proxy.
 
Method Summary
 void close()
          Close communication with this proxy's far end process.
 Status receive(Buf theDst)
          Receive a message from this proxy's far end process.
 Status 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 Detail

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 Detail

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.

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.

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.

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.

close

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



Copyright © 2005-2012 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.