service
Class ProxyCommunication

java.lang.Object
  extended by service.Service
      extended by service.ProxyCommunication
All Implemented Interfaces:
ICommunication

public class ProxyCommunication
extends Service
implements ICommunication

Basic communication service for point to point communication between processes. The communication element embedded in an instance of the DistributedServicesMiddleware class is already implementing this basic communication service. However, it is not possible to directly call its operations as this will interfere with management of messages for others services (all messages for all services are received by this communication element). The goal of the ProxyCommunication class is then to offer the same operations by being a proxy avoiding interferences with other services.


Field Summary
 
Fields inherited from class service.Service
buffer, commElt, dispatcher, myType
 
Constructor Summary
ProxyCommunication()
           
 
Method Summary
 Message asynchReceiveMessage()
          Return a received message coming from any remote process.
 boolean availableMessage()
          Check if there is unread received messages
 void crashProcess()
          Depending of the crash level and a random value generated, crash the process or not
 void sendMessage(Message msg)
          Send a message, tagged with the type of the service, to a given process (more precisely, to the service of the same type on this process)
 void sendMessage(ProcessIdentifier id, java.lang.Object data)
          Send a message to a remote process.
 Message synchReceiveMessage()
          Return a received message coming from any remote process.
 
Methods inherited from class service.Service
initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyCommunication

public ProxyCommunication()
Method Detail

sendMessage

public void sendMessage(Message msg)
                 throws CommunicationException
Description copied from class: Service
Send a message, tagged with the type of the service, to a given process (more precisely, to the service of the same type on this process)

Specified by:
sendMessage in interface ICommunication
Overrides:
sendMessage in class Service
Parameters:
msg - the message to send
Throws:
CommunicationException - in case of communication error

sendMessage

public void sendMessage(ProcessIdentifier id,
                        java.lang.Object data)
                 throws CommunicationException
Description copied from interface: ICommunication
Send a message to a remote process.

Specified by:
sendMessage in interface ICommunication
Parameters:
id - the identifier, including its physical address, of the remote process
data - the data to send to the remote process
Throws:
CommunicationException - in case of communication error

synchReceiveMessage

public Message synchReceiveMessage()
Description copied from interface: ICommunication
Return a received message coming from any remote process. If no unread message is available wait for the reception of a message.

Specified by:
synchReceiveMessage in interface ICommunication
Returns:
the next unread received message

asynchReceiveMessage

public Message asynchReceiveMessage()
Description copied from interface: ICommunication
Return a received message coming from any remote process. If no unread message is available return directly the null value.

Specified by:
asynchReceiveMessage in interface ICommunication
Returns:
the next unread received message or null if none

availableMessage

public boolean availableMessage()
Description copied from interface: ICommunication
Check if there is unread received messages

Specified by:
availableMessage in interface ICommunication
Returns:
true if there is at least one unread received message, false otherwise

crashProcess

public void crashProcess()
Description copied from interface: ICommunication
Depending of the crash level and a random value generated, crash the process or not

Specified by:
crashProcess in interface ICommunication