jgroup.relacs.gm
Class TimestampLayer

java.lang.Object
  extended by jgroup.relacs.gm.TimestampLayer
All Implemented Interfaces:
InternalGMIListener, Layer, Layer.FinalizeLayer, MembershipListener, InternalTimestamp, TimestampService

public class TimestampLayer
extends java.lang.Object
implements TimestampService, MembershipListener, InternalTimestamp

The TimestampLayer creates an agreed timestamp between all the members in a group.

The timestamp can be retrieved as a counter (not unique between groups) or as a timestamp object (unique between groups).

Author:
Rohnny Moland

Nested Class Summary
 
Nested classes/interfaces inherited from interface jgroup.relacs.gm.TimestampService
TimestampService.Timestamp
 
Nested classes/interfaces inherited from interface jgroup.core.Layer
Layer.FinalizeLayer
 
Nested classes/interfaces inherited from interface jgroup.core.MembershipListener
MembershipListener.AllowDuplicateViews
 
Method Summary
 void addListener(java.lang.Object listener)
          Add a listener to this layer.
 void complete(java.lang.Object server)
          This method is invoked on the layer, once the whole Jgroup group manager construction has been completed.
 java.lang.Object getInternalTimestamp()
          Gets the internal timestamp of all members of a group.
static TimestampLayer getLayer(GroupManager gm, MembershipService ms, InternalGMIService igmi)
           
 TimestampService.Timestamp getTimestamp(int id)
          Returns a Timestamp object, and updates the timestamp counter.
 long getTimestampCounter()
          Returns the timestamp counter value, and updates the timestamp counter.
 void hasLeft()
          Upcall that is invoked by Jgroup to acknowledge the fact that this object has left the group.
 void prepareChange()
          Upcall that is invoked by the group membership service to notify that the current view is not valid any more, and the group membership service is trying to reach an agreement on a new view.
 void viewChange(View view)
          Upcall invoked on members implementing the MembershipListener interface, when a view change occurs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLayer

public static TimestampLayer getLayer(GroupManager gm,
                                      MembershipService ms,
                                      InternalGMIService igmi)

addListener

public void addListener(java.lang.Object listener)
Description copied from interface: Layer
Add a listener to this layer. Many layers require to be notified of events produced by other layers in order to provide its own functionallity, and this method must be invoked to notify this layer of an interested listener. A listener may be another layer or an application server replica.

Specified by:
addListener in interface Layer
Parameters:
listener - An Object representation of the listener interface. This will typically be cast to the appropriate listener interface type after checking the type with the instanceof operator.

complete

public void complete(java.lang.Object server)
              throws JgroupException
Description copied from interface: Layer.FinalizeLayer
This method is invoked on the layer, once the whole Jgroup group manager construction has been completed. The complete() method is supposed to implemented stuff that depends on several other group manager components having been constructed.

Specified by:
complete in interface Layer.FinalizeLayer
Parameters:
server - The server using a layer implementing the FinalizeLayer interface.
Throws:
JgroupException - Thrown if the layer could not be completed.

viewChange

public void viewChange(View view)
Description copied from interface: MembershipListener
Upcall invoked on members implementing the MembershipListener interface, when a view change occurs.

Specified by:
viewChange in interface MembershipListener
Parameters:
view - The new view that has been installed.
See Also:
MembershipService

prepareChange

public void prepareChange()
Description copied from interface: MembershipListener
Upcall that is invoked by the group membership service to notify that the current view is not valid any more, and the group membership service is trying to reach an agreement on a new view.

Specified by:
prepareChange in interface MembershipListener
See Also:
MembershipService

hasLeft

public void hasLeft()
Description copied from interface: MembershipListener
Upcall that is invoked by Jgroup to acknowledge the fact that this object has left the group. This method is only invoked after the leave method has been invoked on the group membership service.

Specified by:
hasLeft in interface MembershipListener
See Also:
MembershipService

getInternalTimestamp

public java.lang.Object getInternalTimestamp()
                                      throws java.rmi.RemoteException
Description copied from interface: InternalTimestamp
Gets the internal timestamp of all members of a group.

Specified by:
getInternalTimestamp in interface InternalTimestamp
Returns:
the timestamp
Throws:
java.rmi.RemoteException

getTimestamp

public TimestampService.Timestamp getTimestamp(int id)
Description copied from interface: TimestampService
Returns a Timestamp object, and updates the timestamp counter.

Specified by:
getTimestamp in interface TimestampService

getTimestampCounter

public long getTimestampCounter()
Description copied from interface: TimestampService
Returns the timestamp counter value, and updates the timestamp counter. This is useful for applications that do not need distinguish between groups and different views. That is, if the application is such that the counter value will only be used within the same group, and that view changes are handled otherwise.

Specified by:
getTimestampCounter in interface TimestampService


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.