service
Class Service

java.lang.Object
  extended by service.Service
Direct Known Subclasses:
BasicBroadcastService, IdentificationService, ProxyCommunication, ReliableBroadcastService

public abstract class Service
extends java.lang.Object

Skeleton of a service that has to be specialized for implementing a new service


Field Summary
protected  SynchronizedBuffer<Message> buffer
          Buffer containing the received messages for the service
protected  ICommunication commElt
          Communication element to use to send messages to service parts on other processes
protected  MessageDispatcher dispatcher
          The message dispatcher to use for associating the current service with its type of message
protected  MessageType myType
          The type of the service
 
Constructor Summary
Service()
           
 
Method Summary
 void initialize(MessageDispatcher dispatcher, ICommunication commElt, MessageType myType)
          Initialize the service: register the service on the message dispatcher
protected  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)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dispatcher

protected MessageDispatcher dispatcher
The message dispatcher to use for associating the current service with its type of message


commElt

protected ICommunication commElt
Communication element to use to send messages to service parts on other processes


buffer

protected SynchronizedBuffer<Message> buffer
Buffer containing the received messages for the service


myType

protected MessageType myType
The type of the service

Constructor Detail

Service

public Service()
Method Detail

sendMessage

protected void sendMessage(Message msg)
                    throws CommunicationException
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)

Parameters:
msg - the message to send
Throws:
CommunicationException

initialize

public void initialize(MessageDispatcher dispatcher,
                       ICommunication commElt,
                       MessageType myType)
Initialize the service: register the service on the message dispatcher

Parameters:
dispatcher - the message dispatcher to use for associating the current service with its type of message
commElt - the communication element to use to send messages to service parts on other processes
myType - the type of the service