service.broadcast
Class BasicBroadcastService

java.lang.Object
  extended by service.Service
      extended by service.broadcast.BasicBroadcastService
All Implemented Interfaces:
IBroadcast

public class BasicBroadcastService
extends Service
implements IBroadcast

Implementation of a basic broadcast algorithm


Field Summary
protected  IIdentification idService
           
 
Fields inherited from class service.Service
buffer, commElt, dispatcher, myType
 
Constructor Summary
BasicBroadcastService()
           
 
Method Summary
 Message asynchDeliver()
          Deliver asynchronously the last available received message.
 boolean availableMessage()
           
 void broadcast(java.lang.Object data)
          Broadcast data to all processes of the system.
 void setIdentificationService(IIdentification idService)
           
 Message synchDeliver()
          Deliver synchronously the last available received message.
 
Methods inherited from class service.Service
initialize, sendMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

idService

protected IIdentification idService
Constructor Detail

BasicBroadcastService

public BasicBroadcastService()
Method Detail

setIdentificationService

public void setIdentificationService(IIdentification idService)

broadcast

public void broadcast(java.lang.Object data)
               throws CommunicationException
Description copied from interface: IBroadcast
Broadcast data to all processes of the system.

Specified by:
broadcast in interface IBroadcast
Parameters:
data - the data to be sent
Throws:
CommunicationException - in case of problem

synchDeliver

public Message synchDeliver()
Description copied from interface: IBroadcast
Deliver synchronously the last available received message. If no message is available, wait for the next one.

Specified by:
synchDeliver in interface IBroadcast
Returns:
the last received message

asynchDeliver

public Message asynchDeliver()
Description copied from interface: IBroadcast
Deliver asynchronously the last available received message. If no message is available, return null immediatly.

Specified by:
asynchDeliver in interface IBroadcast
Returns:
the last received message or null if none

availableMessage

public boolean availableMessage()
Specified by:
availableMessage in interface IBroadcast
Returns:
true if one received message is available, false otherwise