JXTA

net.jxta.peergroup
Class PeerGroup.GlobalRegistry

java.lang.Object
  extended by net.jxta.peergroup.PeerGroup.GlobalRegistry
Enclosing interface:
PeerGroup

public static class PeerGroup.GlobalRegistry
extends Object

Global registry of instantiated peer groups. We allow only a single PeerGroup instance for a specific PeerGroupID within the context of the classloader JXTA is loaded into.


Constructor Summary
PeerGroup.GlobalRegistry()
           
 
Method Summary
 PeerGroup lookupInstance(PeerGroupID gid)
          Returns a running instance of the peergroup with given ID if any exists.
 boolean registeredInstance(PeerGroupID gid)
          Returns true if there is a registered peergroup of the specified ID.
 boolean registerInstance(PeerGroupID gid, PeerGroup pg)
          Registers a new instance.
 boolean unRegisterInstance(PeerGroupID gid, PeerGroup pg)
          Unregisters a group instance (normally because the group is being stopped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeerGroup.GlobalRegistry

public PeerGroup.GlobalRegistry()
Method Detail

registerInstance

public boolean registerInstance(PeerGroupID gid,
                                PeerGroup pg)
Registers a new instance.

Parameters:
gid - the ID of the group of which an instance is being registered.
pg - the group instance being registered.
Returns:
false if the instance could not be registered because there was already such an instance registered.

unRegisterInstance

public boolean unRegisterInstance(PeerGroupID gid,
                                  PeerGroup pg)
Unregisters a group instance (normally because the group is being stopped.

Parameters:
gid - the ID of the group of which an instance is unregistered.
pg - the group instance itself (serves as a credential).
Returns:
false if the group could not be unregistered because no such registration (exact ID, exact object) was not found.

lookupInstance

public PeerGroup lookupInstance(PeerGroupID gid)
Returns a running instance of the peergroup with given ID if any exists. The instance should be PeerGroup.unref()ed when it is no longer needed.

Parameters:
gid - the id of the group of which an instance is wanted.
Returns:
the group, or null if no instance exists.

registeredInstance

public boolean registeredInstance(PeerGroupID gid)
Returns true if there is a registered peergroup of the specified ID.

Parameters:
gid - the id of the group of which an instance is wanted.
Returns:
true if the peergroup is currently registered otherwise false;

JXSE