org.objectweb.tribe.faultdetection
Class PingFaultDetectionService

java.lang.Object
  extended byorg.objectweb.tribe.faultdetection.PingFaultDetectionService
All Implemented Interfaces:
FaultDetectionService, Service

public class PingFaultDetectionService
extends java.lang.Object
implements FaultDetectionService, Service

This class defines a PingFaultDetectionService. This will detect missing members by pinging them using regular emission of packets.

Version:
1.0
Author:
Nicolas Modrzyk

Field Summary
 
Fields inherited from interface org.objectweb.tribe.faultdetection.FaultDetectionService
DEFAULT_EMITTING_PORT, DEFAULT_LISTENING_PORT, DEFAULT_REFREST_RATE
 
Constructor Summary
PingFaultDetectionService()
          Creates a new PingFaultDetectionService object
PingFaultDetectionService(int emittingPort, int listeningPort)
          Creates a new PingFaultDetectionService object
 
Method Summary
 void addGroup(Group group)
          Add a group to analyse
 void addListener(FaultDetectionListener listener)
          Add a listener of event
 void addMember(Member member)
          Add a member to the ping service
 java.util.ArrayList getGroups()
          Access all the groups the service is listening to.
 long getRefreshRate()
          Return the value used for refresh rate.
 Group removeGroup(Group group)
          Stop detecting failure for this group
 void removeListener(FaultDetectionListener listener)
          Tell the fault service to no more send event to the listener
 void removeMember(Member member)
          Remove this member from the service
 void setRefreshRate(long delay)
          The intervals to check for new or lost members
 void start()
          Start the service
 void stop()
          Stop the service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PingFaultDetectionService

public PingFaultDetectionService()
                          throws java.net.UnknownHostException
Creates a new PingFaultDetectionService object

Throws:
java.net.UnknownHostException

PingFaultDetectionService

public PingFaultDetectionService(int emittingPort,
                                 int listeningPort)
                          throws java.net.UnknownHostException
Creates a new PingFaultDetectionService object

Parameters:
emittingPort -
listeningPort -
Throws:
java.net.UnknownHostException
Method Detail

setRefreshRate

public void setRefreshRate(long delay)
Description copied from interface: FaultDetectionService
The intervals to check for new or lost members

Specified by:
setRefreshRate in interface FaultDetectionService
Parameters:
delay - long value in milliseconds
See Also:
FaultDetectionService.setRefreshRate(long)

getRefreshRate

public long getRefreshRate()
Description copied from interface: FaultDetectionService
Return the value used for refresh rate. If no value has been set, a default value is used.

Specified by:
getRefreshRate in interface FaultDetectionService
Returns:
long value in milliseconds
See Also:
FaultDetectionService.getRefreshRate()

addGroup

public void addGroup(Group group)
Description copied from interface: FaultDetectionService
Add a group to analyse

Specified by:
addGroup in interface FaultDetectionService
Parameters:
group - Group object that contains the members to listen to
See Also:
FaultDetectionService.addGroup(org.objectweb.tribe.common.Group)

addMember

public void addMember(Member member)
Description copied from interface: FaultDetectionService
Add a member to the ping service

Specified by:
addMember in interface FaultDetectionService
Parameters:
member - Member to listen to
See Also:
FaultDetectionService.addMember(org.objectweb.tribe.common.Member)

removeMember

public void removeMember(Member member)
Description copied from interface: FaultDetectionService
Remove this member from the service

Specified by:
removeMember in interface FaultDetectionService
Parameters:
member - Member to stop listening to
See Also:
FaultDetectionService.removeMember(org.objectweb.tribe.common.Member)

removeGroup

public Group removeGroup(Group group)
Description copied from interface: FaultDetectionService
Stop detecting failure for this group

Specified by:
removeGroup in interface FaultDetectionService
Parameters:
group - Group object that contains the members to listen to
Returns:
group if the group was listened to before, null if no changes has been made.
See Also:
FaultDetectionService.removeGroup(org.objectweb.tribe.common.Group)

getGroups

public java.util.ArrayList getGroups()
Description copied from interface: FaultDetectionService
Access all the groups the service is listening to. This is the original list of groups so any changes to this list will effectivel change the groups we are analysing

Specified by:
getGroups in interface FaultDetectionService
Returns:
an ArrayList of Group
See Also:
FaultDetectionService.getGroups()

start

public void start()
Description copied from interface: Service
Start the service

Specified by:
start in interface Service
See Also:
Service.start()

stop

public void stop()
Description copied from interface: Service
Stop the service

Specified by:
stop in interface Service
See Also:
Service.stop()

addListener

public void addListener(FaultDetectionListener listener)
Description copied from interface: FaultDetectionService
Add a listener of event

Specified by:
addListener in interface FaultDetectionService
Parameters:
listener - FaultDetectionListener to send notification to
See Also:
FaultDetectionService.addListener(org.objectweb.tribe.faultdetection.FaultDetectionListener)

removeListener

public void removeListener(FaultDetectionListener listener)
Description copied from interface: FaultDetectionService
Tell the fault service to no more send event to the listener

Specified by:
removeListener in interface FaultDetectionService
Parameters:
listener - FaultDetectionListener to send notification to
See Also:
FaultDetectionService.removeListener(org.objectweb.tribe.faultdetection.FaultDetectionListener)


Copyright © 2004 - ObjectWeb Consortium - All Rights Reserved.