public class RepGroupImpl
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RepGroupImpl.BarrierState
Encapsulates the last known syncup state associated with a node.
|
static class |
RepGroupImpl.NodeConflictException |
(package private) class |
RepGroupImpl.Predicate |
Constructor and Description |
---|
RepGroupImpl(java.lang.String groupName)
Constructor to create a new empty repGroup, typically as part of
environment initialization.
|
RepGroupImpl(java.lang.String groupName,
boolean unknownUUID) |
RepGroupImpl(java.lang.String groupName,
java.util.UUID uuid,
int version,
int changeVersion,
int nodeIdSequence,
java.util.Map<java.lang.Integer,RepNodeImpl> nodes)
Constructor used to recreate an existing RepGroup, typically as part of
a deserialization operation.
|
Modifier and Type | Method and Description |
---|---|
void |
checkForConflicts(RepNodeImpl node)
Checks for whether a new node definition is in conflict with the current
members of the group.
|
static RepGroupImpl |
deserializeHex(java.lang.String[] tokens,
int start)
De-serializes an array of tokens into a Rep group object and its nodes.
|
static RepNodeImpl |
deserializeNode(byte[] bytes)
Deserialize the mode from its byte representation.
|
boolean |
equals(java.lang.Object obj) |
java.util.Set<java.net.InetSocketAddress> |
getAcceptorSockets()
Returns the sockets used by nodes running Acceptor agents, that is,
just nodes which participate in elections and can become Masters.
|
java.util.Set<RepNodeImpl> |
getAllElectableMembers()
Returns the subset of Electable nodes in the group.
|
java.util.Set<java.lang.Integer> |
getAllMemberIds()
Returns the nodes ids associated with all the nodes that are members
of the group.
|
java.util.Set<RepNodeImpl> |
getAllMembers(RepGroupImpl.Predicate p) |
int |
getChangeVersion()
Returns the version of the instance as represented by changes to the
members constituting the group.
|
int |
getElectableGroupSize()
Note that even unACKed nodes are considered part of the group for
group size/durability considerations.
|
java.util.Set<RepNodeImpl> |
getElectableNodes() |
static int |
getFirstNodeId()
Returns the node ID that is associated with the very first node in the
replication group.
|
java.util.Set<java.net.InetSocketAddress> |
getLearnerSockets()
Return all learner sockets.
|
RepNodeImpl |
getMember(int nodeId) |
RepNodeImpl |
getMember(java.lang.String name)
Lookup for existing members.
|
java.util.Set<RepNodeImpl> |
getMonitorNodes()
Returns the monitor nodes that are members of the group.
|
java.util.Set<java.net.InetSocketAddress> |
getMonitorSockets()
Returns the sockets used by just the Monitor nodes in the group
|
java.lang.String |
getName() |
int |
getNextNodeId()
Increments the node ID sequence and returns it.
|
RepNodeImpl |
getNode(int nodeId)
Get the node, if it's present, regardless of its membership state.
|
RepNodeImpl |
getNode(java.lang.String name)
Get the node, if it's present, regardless of its membership state.
|
int |
getNodeIdSequence()
Returns the current highest node ID currently in use by the group.
|
java.util.Set<RepNodeImpl> |
getRemovedNodes() |
java.util.UUID |
getUUID()
returns the unique UUID associated with the replicated environment.
|
int |
getVersion()
Returns the version of the representation (the schema) in use by this
group instance in the database.
|
int |
hashCode() |
boolean |
hasUnknownUUID() |
static RepNodeImpl |
hexDeserializeNode(java.lang.String hex)
Deserializes the object serialized by
serializeHex() |
int |
incrementChangeVersion()
Increments the object change version.
|
static boolean |
isUnknownUUID(java.util.UUID uuid)
Predicate to help determine whether the UUID is the canonical unknown
UUID.
|
void |
makeConsistent()
Used to ensure that the ReplicationGroup value is consistent after it
has been fetched via a readUncommitted access to the rep group database.
|
(package private) static <T> java.lang.String |
objectToHex(TupleBinding<T> binding,
T object)
Serializes an object by converting its TupleBinding byte based
representation into the hex characters deonoting the bytes.
|
RepNodeImpl |
removeMember(java.lang.String nodeName)
Removes a member transiently from the rep group by marking it as being
deleted.
|
static byte[] |
serializeBytes(RepNodeImpl node)
Serialize the node into its byte representation.
|
java.lang.String |
serializeHex()
Returns a serialized character based form of the group suitable for use
in subclasses of SimpleProtocol.
|
static java.lang.String |
serializeHex(RepNodeImpl node)
Returns the serialized form of the node as a sequence of hex characters
suitable for use by the text based protocols.
|
void |
setNodeIdSequence(int nodeIdSequence)
Set the node id sequence.
|
void |
setNodes(java.util.Map<java.lang.Integer,RepNodeImpl> nodes)
Sets the nodes associated with the Rep group.
|
void |
setUUID(java.util.UUID uuid)
Sets the UUID.
|
java.lang.String |
toString()
Return information to the user, format nicely for ease of reading.
|
public RepGroupImpl(java.lang.String groupName)
groupName
- public RepGroupImpl(java.lang.String groupName, boolean unknownUUID)
public RepGroupImpl(java.lang.String groupName, java.util.UUID uuid, int version, int changeVersion, int nodeIdSequence, java.util.Map<java.lang.Integer,RepNodeImpl> nodes)
groupName
- uuid
- version
- changeVersion
- nodes
- public boolean hasUnknownUUID()
public static boolean isUnknownUUID(java.util.UUID uuid)
public void setUUID(java.util.UUID uuid)
public RepNodeImpl removeMember(java.lang.String nodeName)
nodeName
- identifies the node being removedEnvironmentFailureException
- if the node is not part of the grouppublic void checkForConflicts(RepNodeImpl node) throws DatabaseException, RepGroupImpl.NodeConflictException
node
- the new node that is being checked for conflictsRepGroupImpl.NodeConflictException
- if there is a conflictDatabaseException
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public void setNodes(java.util.Map<java.lang.Integer,RepNodeImpl> nodes)
public java.util.UUID getUUID()
public int getVersion()
public int getChangeVersion()
public int incrementChangeVersion()
public int getNodeIdSequence()
public void setNodeIdSequence(int nodeIdSequence)
public int getNextNodeId()
public static int getFirstNodeId()
public void makeConsistent()
static <T> java.lang.String objectToHex(TupleBinding<T> binding, T object)
T
- the type of the object being serializedbinding
- the tuble binding used to convert it into its byte formobject
- the object being serializedpublic java.lang.String serializeHex()
public static java.lang.String serializeHex(RepNodeImpl node)
node
- the node to be serialized.public static byte[] serializeBytes(RepNodeImpl node)
node
- the node to be serializedpublic static RepNodeImpl hexDeserializeNode(java.lang.String hex)
serializeHex()
hex
- the string containing the serialized form of the nodepublic static RepNodeImpl deserializeNode(byte[] bytes)
bytes
- the byte representation of the node.public static RepGroupImpl deserializeHex(java.lang.String[] tokens, int start)
start
represents the group object and each
subsequent token represents a node in the group.tokens
- the array representing the group and its nodesstart
- the position in the array at which to start the
de-serialization.public java.util.Set<java.lang.Integer> getAllMemberIds()
public java.util.Set<RepNodeImpl> getAllMembers(RepGroupImpl.Predicate p)
public java.util.Set<RepNodeImpl> getRemovedNodes()
public java.util.Set<RepNodeImpl> getAllElectableMembers()
public java.util.Set<RepNodeImpl> getElectableNodes()
public java.util.Set<RepNodeImpl> getMonitorNodes()
public java.util.Set<java.net.InetSocketAddress> getLearnerSockets()
public java.util.Set<java.net.InetSocketAddress> getMonitorSockets()
public java.util.Set<java.net.InetSocketAddress> getAcceptorSockets()
public RepNodeImpl getMember(int nodeId)
public RepNodeImpl getMember(java.lang.String name) throws MemberNotFoundException
MemberNotFoundException
public RepNodeImpl getNode(int nodeId)
public RepNodeImpl getNode(java.lang.String name)
public int getElectableGroupSize()
public java.lang.String getName()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) 2004-2012 Oracle. All rights reserved.