public abstract class ClusterPod
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ClusterPod.Owner
For any object, assigns an owner and backup in the triad.
|
Modifier and Type | Field and Description |
---|---|
static ClusterPod.Owner[] |
OWNER_VALUES |
Modifier | Constructor and Description |
---|---|
protected |
ClusterPod(Cluster cluster,
int index)
Creates a new triad for the cluster.
|
Modifier and Type | Method and Description |
---|---|
void |
addDynamicServer(java.lang.String serverId,
java.lang.String address,
int port)
Adds a dynamic server
|
void |
addServer(ClusterServer server)
Adds cluster server
|
void |
close()
Closes the servers in the triad.
|
abstract ClusterServer |
createServer()
Creates a cluster server
|
ClusterServer |
findServer(int index)
Finds the matching server.
|
ClusterServer |
findServer(java.lang.String id)
Finds the first server with the given id
|
ClusterServer |
findServer(java.lang.String address,
int port)
Finds the first server with the given address and port
|
ClusterServer |
findServerByPrefix(java.lang.String id)
Finds the first server with the given id
|
ClusterServer |
getActiveOrSelfServer(ClusterPod.Owner owner,
ClusterServer oldServer)
Returns the best primary or secondary triad server.
|
ClusterServer |
getActiveServer(ClusterPod.Owner owner,
ClusterServer oldServer)
Returns the best primary or secondary triad server.
|
Cluster |
getCluster()
Returns the triad's cluster
|
java.lang.String |
getId()
Returns the triad id.
|
int |
getIndex()
Returns the triad index.
|
static ClusterPod.Owner |
getOwner(long index)
Returns the owner for an index
|
abstract OwnerServerTriad |
getOwnerServerTriad(ClusterPod.Owner owner)
Returns the OwnerServerTriad for the given owner.
|
ClusterServer |
getPrimary(ClusterPod.Owner owner)
Returns the primary server given an ownership tag.
|
ClusterServer |
getSecondary(ClusterPod.Owner owner)
Returns the secondary server given an ownership tag.
|
abstract ClusterServer |
getServerA()
Returns the triad's first server
|
abstract ClusterServer |
getServerB()
Returns the triad's second server
|
abstract ClusterServer |
getServerC()
Returns the triad's third server
|
abstract ClusterServer[] |
getServerList()
Return the servers statically configured in the triad
|
abstract java.util.ArrayList<ClusterServer> |
getStaticServerList()
Return the servers statically configured in the triad
|
ClusterServer |
getTertiary(ClusterPod.Owner owner)
Returns the tertiary server given an ownership tag.
|
void |
init()
Initializes the servers in the triad.
|
boolean |
isTriad(ClusterServer server)
Returns true for any of the triad servers.
|
void |
removeDynamicServer(java.lang.String serverId,
java.lang.String address,
int port)
Remove a dynamic server
|
ClusterServer |
setActiveDynamicServer(java.lang.String serverId,
java.lang.String address,
int port,
int index)
Sets the active dynamic server
|
void |
start() |
java.lang.String |
toString() |
void |
update()
Update for dynamic server
|
public static final ClusterPod.Owner[] OWNER_VALUES
protected ClusterPod(Cluster cluster, int index)
cluster
- the owning clusterindex
- the triad indexpublic java.lang.String getId()
public int getIndex()
public Cluster getCluster()
public abstract ClusterServer[] getServerList()
public abstract java.util.ArrayList<ClusterServer> getStaticServerList()
public abstract ClusterServer getServerA()
public abstract ClusterServer getServerB()
public abstract ClusterServer getServerC()
public boolean isTriad(ClusterServer server)
public ClusterServer findServer(int index)
public abstract ClusterServer createServer()
public void addServer(ClusterServer server)
public void addDynamicServer(java.lang.String serverId, java.lang.String address, int port) throws ConfigException
ConfigException
public void removeDynamicServer(java.lang.String serverId, java.lang.String address, int port) throws ConfigException
ConfigException
public ClusterServer setActiveDynamicServer(java.lang.String serverId, java.lang.String address, int port, int index) throws ConfigException
ConfigException
public void init()
public void start()
public void update()
public void close()
public ClusterServer findServer(java.lang.String id)
public ClusterServer findServerByPrefix(java.lang.String id)
public ClusterServer findServer(java.lang.String address, int port)
public abstract OwnerServerTriad getOwnerServerTriad(ClusterPod.Owner owner)
public ClusterServer getPrimary(ClusterPod.Owner owner)
public ClusterServer getSecondary(ClusterPod.Owner owner)
public ClusterServer getTertiary(ClusterPod.Owner owner)
public ClusterServer getActiveServer(ClusterPod.Owner owner, ClusterServer oldServer)
public ClusterServer getActiveOrSelfServer(ClusterPod.Owner owner, ClusterServer oldServer)
public static ClusterPod.Owner getOwner(long index)
public java.lang.String toString()
toString
in class java.lang.Object