gsim.sim.communication
Class MethodInvocationProtocolSender

java.lang.Object
  extended by gsim.sim.communication.AbstractCommunicationProtocol
      extended by gsim.sim.communication.CommunicationProtocol
          extended by gsim.sim.communication.MethodInvocationProtocolSender
All Implemented Interfaces:
java.io.Serializable

public class MethodInvocationProtocolSender
extends CommunicationProtocol

Any communication in gsim is defined ASYNCHRONOSLY (even in the single-machin case for coherent semantics). A method invocation must there for register an observer if using this convenience class, or code all logic within the respond-method of the protocol.

Author:
s.schuster@surrey.ac.uk
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gsim.sim.communication.CommunicationProtocol
timeOut
 
Constructor Summary
MethodInvocationProtocolSender(java.lang.String ownName, java.lang.String receiverName, java.lang.String methodName, java.lang.Object[] params)
           
 
Method Summary
 java.util.Observable getObservable()
           
 java.lang.Object getResult()
          Blocks until protocol has finished.
 Message getStartMessage()
           
 Message respond(Message message)
           
 
Methods inherited from class gsim.sim.communication.CommunicationProtocol
equals, getCommId, getOwnName, getPartnerName, getReceiverProtocol, hashCode, setCommId
 
Methods inherited from class gsim.sim.communication.AbstractCommunicationProtocol
onEnd
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodInvocationProtocolSender

public MethodInvocationProtocolSender(java.lang.String ownName,
                                      java.lang.String receiverName,
                                      java.lang.String methodName,
                                      java.lang.Object[] params)
Method Detail

getObservable

public java.util.Observable getObservable()

getResult

public java.lang.Object getResult()
Blocks until protocol has finished.

Returns:
the result value of the called method

getStartMessage

public Message getStartMessage()
Specified by:
getStartMessage in class CommunicationProtocol

respond

public Message respond(Message message)
Specified by:
respond in class AbstractCommunicationProtocol