jgroup.arm
Class ReplicaManagerImpl

java.lang.Object
  extended by jgroup.arm.ReplicaManagerImpl
All Implemented Interfaces:
java.rmi.Remote, ReplicationManager, ExternalGMIListener, MembershipListener, MergingListener

public class ReplicaManagerImpl
extends java.lang.Object
implements ReplicationManager, MembershipListener, MergingListener

This implementation of the replication manager interfaces make use of a variant of the semi-active replication scheme, in which only the leader RM replica receive and process the requests, while the follower replicas receive state update messages through the StateListener interface. This permits that only the leader perform creation and removal of replicas at hosts in the distributed system, ensuring that only one group is created in response to a createGroup() request.

This is done to prevent problems of non-determinism due to multithreading in the Correlator.

The RM leader replica communicate with ExecDaemon (factory) objects at the hosts that are supposed to server replicas of any type. The operations that can be performed on the ExecDaemons are typically idempotent.

Other application-level layers (or even servers) may also communicate arbitrary events to the replication manager. For instance, the RecoveryLayer will provide ViewChangeEvent notifications to the RM leader when the group assoicated with a RecoveryLayer instance has installed a new view. Furthermore, the RecoveryLayer also implements a lease based liveness timer in case multiple replicas fail simultaneously.

The events that can be communicated to the replication manager must implement the ARMEvent interface, and must handle its own event when received at the replication manager. The replication manager supports several different implementations of the RecoveryStrategy interface, allowing different applications to provide specific recovery needs. For instance, one such recovery strategy is the KeepMinimalInPartition, which does just that. The replication manager also provide self-recovery, by reusing the same infrastructure used by the application-level recovery. However, there is no recovery in case all replication manager replicas has been exhausted.

Since:
Jgroup 1.2
Author:
Hein Meling

Nested Class Summary
 
Nested classes/interfaces inherited from interface jgroup.core.arm.ReplicationManager
ReplicationManager.ManagementCallback
 
Nested classes/interfaces inherited from interface jgroup.core.MembershipListener
MembershipListener.AllowDuplicateViews
 
Method Summary
 int createGroup(AppConfig app)
          Create a group for the specified application, with the applications required redundancy.
 java.lang.Object getState(MemberId[] dests)
          Method getState is invoked when the member has been selected as coordinator for the reconciliation protocol.
 void hasLeft()
          Upcall that is invoked by Jgroup to acknowledge the fact that this object has left the group.
static void main(java.lang.String[] argv)
           
 void notifyEvent(ARMEvent event)
          The notifyEvent method is used by components external to the replication manager to notify it of important events, such as the presence of a new host (ExecDaemon) or view change events from the RecoveryLayer.
 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 putState(java.lang.Object state, MemberId[] sources)
          Method putState is invoked to inform the member about the state of other members belonging to different partitions.
 void removeGroup(AppConfig app)
          Remove the group for the given application.
 void subscribe(ReplicationManager.ManagementCallback callback, int gid)
          Register to receive notifications for the given group.
 void unsubscribe(int gid)
          Unregister to receive notifications for the given group.
 void updateGroup(AppConfig app)
          Update the replication policy for the group for the given application.
 void viewChange(View view)
          View change for the replication manager group; set the leader replica, and ensure that the grouptable is correctly updated with respect to this view change from the RM group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

notifyEvent

@Multicast
public void notifyEvent(ARMEvent event)
                 throws java.rmi.RemoteException,
                        java.lang.Exception
Description copied from interface: ReplicationManager
The notifyEvent method is used by components external to the replication manager to notify it of important events, such as the presence of a new host (ExecDaemon) or view change events from the RecoveryLayer.

The method takes arbitrary event types as long as they implement the interface ARMEvent.

Specified by:
notifyEvent in interface ReplicationManager
Parameters:
event - An event notification for the replication manager.
Throws:
java.rmi.RemoteException - Raised if the remote operation failed.
java.lang.Exception

createGroup

@Multicast
public int createGroup(AppConfig app)
                throws java.rmi.RemoteException,
                       RedundancyException,
                       GroupExistsException
Description copied from interface: ReplicationManager
Create a group for the specified application, with the applications required redundancy.

Specified by:
createGroup in interface ReplicationManager
Parameters:
app - The application details required to create a group for it.
Returns:
The group identifier.
Throws:
java.rmi.RemoteException - Raised if there was communication problems; only when invoked remotely.
RedundancyException - Raised if the specified redundancy could not be satisfied.
GroupExistsException - Raised if the specified group already exists.

removeGroup

@Multicast
public void removeGroup(AppConfig app)
                 throws java.rmi.RemoteException,
                        UnknownGroupException
Description copied from interface: ReplicationManager
Remove the group for the given application.

Specified by:
removeGroup in interface ReplicationManager
Parameters:
app - The application group to remove.
Throws:
java.rmi.RemoteException - Raised if there was communication problems; only when invoked remotely.
UnknownGroupException - Raised if the specified application has no group in the system.

updateGroup

@Multicast
public void updateGroup(AppConfig app)
Description copied from interface: ReplicationManager
Update the replication policy for the group for the given application.

Specified by:
updateGroup in interface ReplicationManager
Parameters:
app - The application group to remove.

subscribe

@Multicast
public void subscribe(ReplicationManager.ManagementCallback callback,
                                int gid)
               throws java.rmi.RemoteException,
                      UnknownGroupException
Description copied from interface: ReplicationManager
Register to receive notifications for the given group.

Specified by:
subscribe in interface ReplicationManager
Parameters:
callback - The callback server (typically a management client)
gid - The group for which notifications are desired
Throws:
java.rmi.RemoteException - Raised if there was communication problems; only when invoked remotely.
UnknownGroupException - Raised if the specified application has no group in the system.

unsubscribe

@Multicast
public void unsubscribe(int gid)
                 throws java.rmi.RemoteException,
                        UnknownGroupException
Description copied from interface: ReplicationManager
Unregister to receive notifications for the given group.

Specified by:
unsubscribe in interface ReplicationManager
Parameters:
gid - The group for which notifications are no longer desired
Throws:
java.rmi.RemoteException - Raised if there was communication problems; only when invoked remotely.
UnknownGroupException - Raised if the specified application has no group in the system.

viewChange

public void viewChange(View view)
View change for the replication manager group; set the leader replica, and ensure that the grouptable is correctly updated with respect to this view change from the RM group.

Specified by:
viewChange in interface MembershipListener
Parameters:
view - The new view that has been installed.
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

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

getState

public java.lang.Object getState(MemberId[] dests)
Description copied from interface: MergingListener
Method getState is invoked when the member has been selected as coordinator for the reconciliation protocol.

Specified by:
getState in interface MergingListener
Parameters:
dests - The destination set of the reconciliation message;
Returns:
The reconciliation message

putState

public void putState(java.lang.Object state,
                     MemberId[] sources)
Description copied from interface: MergingListener
Method putState is invoked to inform the member about the state of other members belonging to different partitions.

Specified by:
putState in interface MergingListener
Parameters:
state - The reconciliation message
sources - The state contained in status is already known by members in sources.

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
Throws:
java.lang.Exception


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