jgroup.relacs.registry
Class RegistryImpl

java.lang.Object
  extended by jgroup.relacs.registry.RegistryImpl
All Implemented Interfaces:
java.rmi.Remote, ExternalGMIListener, MembershipListener, MergingListener, DependableRegistry, LookupRegistry

public final class RegistryImpl
extends java.lang.Object
implements DependableRegistry, MergingListener, MembershipListener

This class implements the DependableRegistry interface.

Since:
Jgroup 0.4
Author:
Alberto Montresor, Hein Meling

Nested Class Summary
 
Nested classes/interfaces inherited from interface jgroup.core.registry.DependableRegistry
DependableRegistry.RegistryEntry
 
Nested classes/interfaces inherited from interface jgroup.core.MembershipListener
MembershipListener.AllowDuplicateViews
 
Field Summary
 
Fields inherited from interface jgroup.core.registry.DependableRegistry
DEPENDABLE_REGISTRY_NAME
 
Constructor Summary
RegistryImpl()
          Creates and exports a dependable registry replica on the local host that listen to incoming requests on an anonymous communication port.
RegistryImpl(GroupManager gm)
          Special constructor for creating the dependable registry as part of another group (e.g., the replication manager group).
RegistryImpl(GroupManager gm, java.rmi.server.RMIClientSocketFactory csf, java.rmi.server.RMIServerSocketFactory ssf)
          Creates and exports a dependable registry replica on the local host that listen to incoming requests on the port specified within the configuration object.
RegistryImpl(java.rmi.server.RMIClientSocketFactory csf, java.rmi.server.RMIServerSocketFactory ssf)
          Creates and exports a dependable registry replica on the local host that listen to incoming requests on the port specified within the configuration object.
 
Method Summary
 IID bind(java.lang.String service, DependableRegistry.RegistryEntry entry, java.lang.Class serverClass)
          Add a replicated member object to the remote object group associated with the specified name in the registry.
 IID bind(java.lang.String service, DependableRegistry.RegistryEntry entry, java.lang.Class serverClass, long leaseTime)
          Add a replicated member object to the remote object group associated with the specified name in the registry.
 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.
 java.lang.String[] list()
          Returns an array containing the remote object group names registered in the registry.
 java.rmi.Remote lookup(java.lang.String serviceName)
          Returns a proxy for the remote object group associated with the specified name in the registry.
static void main(java.lang.String[] argv)
          Main method of the class
 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 obj, MemberId[] sources)
          Method putState is invoked to inform the member about the state of other members belonging to different partitions.
 void refresh(IID iid)
          Update the timestamp (lease time) for the server associated with the given binding identifier (IID).
 void shutdown()
           
 void unbind(IID iid)
          Remove a replicated remote object identified by the IID object obtained when the replica has been registered.
 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
 

Constructor Detail

RegistryImpl

public RegistryImpl()
             throws java.rmi.RemoteException,
                    JgroupException,
                    ConfigurationException
Creates and exports a dependable registry replica on the local host that listen to incoming requests on an anonymous communication port. Objects contained in the conf map are used by Jgroup to configure the group communication system; the distributed system description must be included in this map object.

Throws:
java.rmi.RemoteException - If the registry could not be exported
JgroupException - Generic exception raised by Jgroup
ConfigurationException - Raised when the distributed system configuration object contains an error

RegistryImpl

public RegistryImpl(GroupManager gm)
             throws java.rmi.RemoteException,
                    JgroupException,
                    ConfigurationException
Special constructor for creating the dependable registry as part of another group (e.g., the replication manager group). Creates and exports a dependable registry replica on the local host that listen to incoming requests on an anonymous communication port. Objects contained in the conf map are used by Jgroup to configure the group communication system; the distributed system description must be included in this map object.

Throws:
java.rmi.RemoteException - If the registry could not be exported
JgroupException - Generic exception raised by Jgroup
ConfigurationException - Raised when the distributed system configuration object contains an error

RegistryImpl

public RegistryImpl(java.rmi.server.RMIClientSocketFactory csf,
                    java.rmi.server.RMIServerSocketFactory ssf)
             throws java.rmi.RemoteException,
                    JgroupException,
                    ConfigurationException
Creates and exports a dependable registry replica on the local host that listen to incoming requests on the port specified within the configuration object. Objects contained in the conf map are used by Jgroup to configure the group communication system; the distributed system description must be included in this map object. The new instance listens to incoming requests using a ServerSocket created from the supplied RMIServerSocketFactory. A client that receives a reference to this registry will use a Socket created from the supplied RMIClientSocketFactory.

Parameters:
csf - Client-side Socket factory used to make connections to the registry
ssf - Server-side ServerSocket factory used to accept connections to the registry
Throws:
java.rmi.RemoteException - If the registry could not be exported
JgroupException - Generic exception raised by Jgroup
ConfigurationException - Raised when the distributed system configuration object contains an error

RegistryImpl

public RegistryImpl(GroupManager gm,
                    java.rmi.server.RMIClientSocketFactory csf,
                    java.rmi.server.RMIServerSocketFactory ssf)
             throws java.rmi.RemoteException,
                    JgroupException,
                    ConfigurationException
Creates and exports a dependable registry replica on the local host that listen to incoming requests on the port specified within the configuration object. Objects contained in the conf map are used by Jgroup to configure the group communication system; the distributed system description must be included in this map object. The new instance listens to incoming requests using a ServerSocket created from the supplied RMIServerSocketFactory. A client that receives a reference to this registry will use a Socket created from the supplied RMIClientSocketFactory.

Parameters:
csf - Client-side Socket factory used to make connections to the registry
ssf - Server-side ServerSocket factory used to accept connections to the registry
Throws:
java.rmi.RemoteException - If the registry could not be exported
JgroupException - Generic exception raised by Jgroup
ConfigurationException - Raised when the distributed system configuration object contains an error
Method Detail

main

public static void main(java.lang.String[] argv)
Main method of the class


bind

@Multicast
public IID bind(java.lang.String service,
                          DependableRegistry.RegistryEntry entry,
                          java.lang.Class serverClass)
         throws java.rmi.RemoteException,
                java.rmi.AccessException
Description copied from interface: DependableRegistry
Add a replicated member object to the remote object group associated with the specified name in the registry.

Specified by:
bind in interface DependableRegistry
Parameters:
service - The name associated with the remote object group
entry - The RegistryEntry type associated with the member object implementation
serverClass - The class object of the member object implementation
Returns:
A IID identifier that can be used to remove a replicated remote object from the binding set.
Throws:
java.rmi.RemoteException - Raised when remote operation failed.
java.rmi.AccessException - Raised when this operation is not permitted.

bind

@Multicast
public IID bind(java.lang.String service,
                          DependableRegistry.RegistryEntry entry,
                          java.lang.Class serverClass,
                          long leaseTime)
         throws java.rmi.RemoteException,
                java.rmi.AccessException
Description copied from interface: DependableRegistry
Add a replicated member object to the remote object group associated with the specified name in the registry.

Specified by:
bind in interface DependableRegistry
Parameters:
service - The name associated with the remote object group
entry - The RegistryEntry type associated with the member object implementation
serverClass - The class object of the member object implementation
leaseTime - The lease time for the service
Returns:
A IID identifier that can be used to remove a replicated remote object from the binding set.
Throws:
java.rmi.RemoteException - Raised when remote operation failed.
java.rmi.AccessException - Raised when this operation is not permitted.

unbind

@Multicast
public void unbind(IID iid)
            throws java.rmi.RemoteException,
                   java.rmi.NotBoundException,
                   java.rmi.AccessException
Description copied from interface: DependableRegistry
Remove a replicated remote object identified by the IID object obtained when the replica has been registered.

Specified by:
unbind in interface DependableRegistry
Parameters:
iid - the binding identifier obtained when the replica has been registered
Throws:
java.rmi.RemoteException - If remote operation failed.
java.rmi.AccessException - If this operation is not permitted.
java.rmi.NotBoundException - if there is no object with this name in the registry.

list

@Anycast
public java.lang.String[] list()
                        throws java.rmi.RemoteException
Description copied from interface: LookupRegistry
Returns an array containing the remote object group names registered in the registry. When LeaseLayer is used, it checks to see if any servers have expired leasetimes.

Specified by:
list in interface LookupRegistry
Throws:
java.rmi.RemoteException - If remote operation failed.
java.rmi.AccessException - If this operation is not permitted.

lookup

@Anycast
public java.rmi.Remote lookup(java.lang.String serviceName)
                       throws java.rmi.RemoteException,
                              java.rmi.NotBoundException
Description copied from interface: LookupRegistry
Returns a proxy for the remote object group associated with the specified name in the registry. When LeaseLayer is used, it checks to see if any servers have expired leasetimes.

Specified by:
lookup in interface LookupRegistry
Parameters:
serviceName - the name associated with the remote object group
Returns:
a proxy for the remote object group
Throws:
java.rmi.RemoteException - If remote operation failed.
java.rmi.AccessException - If this operation is not permitted.
java.rmi.NotBoundException - if there is no object group with this name in the registry.

refresh

@Multicast
public void refresh(IID iid)
             throws java.rmi.RemoteException,
                    java.rmi.AccessException,
                    java.rmi.NotBoundException
Description copied from interface: DependableRegistry
Update the timestamp (lease time) for the server associated with the given binding identifier (IID). This method is used by the server-side LeaseLayer and is invoked through the RegistryLayer.

Specified by:
refresh in interface DependableRegistry
Parameters:
iid - The iid of the server whose lease to refresh.
Throws:
java.rmi.RemoteException - If remote operation failed.
java.rmi.AccessException - If this operation is not permitted.
java.rmi.NotBoundException - if there is no object in the registry matching the given IID.

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

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

shutdown

public void shutdown()

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 obj,
                     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:
obj - The reconciliation message
sources - The state contained in status is already known by members in sources.


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