Berkeley DB Java Edition
version 4.0.103

com.sleepycat.je.rep.util
Class ReplicationGroupAdmin

java.lang.Object
  extended by com.sleepycat.je.rep.util.ReplicationGroupAdmin

public class ReplicationGroupAdmin
extends Object

Administrative APIs for use by applications which do not have direct access to a replicated environment. The class supplies methods that can be used to list group members, remove members, and find the current master. The information is found by querying nodes in the group. Because of that, ReplicationGroupAdmin can only obtain information when there is at least one node alive in the replication group.


Constructor Summary
ReplicationGroupAdmin(String groupName, Set<InetSocketAddress> helperSockets)
          Constructs a group admin object.
 
Method Summary
 ReplicationGroup getGroup()
          Returns the current composition of the group from the Master.
 String getGroupName()
          Returns the name of the replication group.
 Set<InetSocketAddress> getHelperSockets()
          Returns the helper sockets being used to contact a replication group member, in order to query for the information.
 String getMasterNodeName()
          Returns the node name associated with the master
 void removeMember(String nodeName)
          Removes this node from the group, so that it is no longer a member of the group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplicationGroupAdmin

public ReplicationGroupAdmin(String groupName,
                             Set<InetSocketAddress> helperSockets)
Constructs a group admin object.

Parameters:
groupName - the name of the group to be administered
helperSockets - the sockets on which it can contact helper nodes in the replication group to carry out admin services.
Method Detail

getHelperSockets

public Set<InetSocketAddress> getHelperSockets()
Returns the helper sockets being used to contact a replication group member, in order to query for the information.

Returns:
the set of helper sockets.

getGroupName

public String getGroupName()
Returns the name of the replication group.

Returns:
the group name.

getMasterNodeName

public String getMasterNodeName()
                         throws UnknownMasterException,
                                EnvironmentFailureException
Returns the node name associated with the master

Returns:
the master node id
Throws:
UnknownMasterException - if the master was not found
EnvironmentFailureException - if an unexpected, internal or environment-wide failure occurs.

removeMember

public void removeMember(String nodeName)
                  throws UnknownMasterException,
                         MemberNotFoundException,
                         MasterStateException,
                         EnvironmentFailureException
Removes this node from the group, so that it is no longer a member of the group. When removed, it will no longer be able to connect to a master, nor can it participate in elections. If the node is a Monitor it will no longer be informed of election results. Once removed, a node cannot be added again to the group under the same node name.

Ideally, the node being removed should be shut down before this call is issued.

If the node is an active Replica the master will terminate its connection with the node and will not allow the replica to reconnect with the group, since it's no longer a member of the group. If the node wishes to re-join it should do so with a different node name.

An active Master cannot be removed. It must first be shutdown, or transition to the Replica state before it can be removed from the group.

Parameters:
nodeName - identifies the node being removed from the group
Throws:
UnknownMasterException - if the master was not found
MemberNotFoundException - if the node denoted by nodeName is not a member of the replication group
MasterStateException - if the member being removed is currently the Master
EnvironmentFailureException - if an unexpected, internal or environment-wide failure occurs.
See Also:
Adding and Removing Nodes From the Group

getGroup

public ReplicationGroup getGroup()
                          throws UnknownMasterException,
                                 EnvironmentFailureException
Returns the current composition of the group from the Master.

Returns:
the group description
Throws:
UnknownMasterException - if the master was not found
EnvironmentFailureException - if an unexpected, internal or environment-wide failure occurs

Berkeley DB Java Edition
version 4.0.103

Copyright (c) 2004-2010 Oracle. All rights reserved.