public abstract class AbstractClusterManager extends java.lang.Object implements ClusterManager
ClusterManager. This implementation assumes that
distributed properties are contained in some distributed Map.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractClusterManager(ClusterConfigurationProperties clusterConfigurationProperties)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected ClusterConfigurationProperties |
getClusterConfigurationProperties()
Returns the cluster configuration properties.
|
protected abstract java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Returns the map that backs distributed properties.
|
java.lang.String |
getProperty(java.lang.String name)
Retrieves a distributed property.
|
<T> T |
getProperty(java.lang.String name,
java.lang.Class<T> clazz)
Retrieves a distributed property.
|
<T> T |
getProperty(java.lang.String name,
java.lang.Class<T> clazz,
T defaultValue)
Retrieves a distributed property.
|
void |
setProperty(java.lang.String name,
java.lang.Object value)
Sets a distributed property and syncs it with all cluster members.
|
protected abstract <T> java.util.concurrent.Future<? extends T> |
submitInstruction(ClusterMember clusterMember,
Instruction<? extends T> instruction)
Submits the given instruction to the given cluster member.
|
<T> java.util.Map<ClusterMember,T> |
submitInstruction(Instruction<? extends T> instruction)
Submits an instruction to all cluster members.
|
<T> java.util.Map<ClusterMember,T> |
submitInstructions(java.util.Map<ClusterMember,? extends Instruction<? extends T>> instructions)
Submits instructions to members of the cluster.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetClusterMembersprotected AbstractClusterManager(ClusterConfigurationProperties clusterConfigurationProperties)
clusterConfigurationProperties - Scheduler configuration properties.protected abstract <T> java.util.concurrent.Future<? extends T> submitInstruction(ClusterMember clusterMember, Instruction<? extends T> instruction)
T - The return type of the instruction.clusterMember - Cluster member to run the instruction on.instruction - Instruction to run.protected abstract java.util.Map<java.lang.String,java.lang.Object> getProperties()
public <T> java.util.Map<ClusterMember,T> submitInstruction(Instruction<? extends T> instruction) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
submitInstruction in interface ClusterManagerT - The return type of the instruction.instruction - instructions to run on all cluster members.java.util.concurrent.ExecutionException - when an error during execution occurs.java.lang.InterruptedException - when the processes is interrupted.public <T> java.util.Map<ClusterMember,T> submitInstructions(java.util.Map<ClusterMember,? extends Instruction<? extends T>> instructions) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
submitInstructions in interface ClusterManagerT - The return type of the instruction.instructions - instructions to run on cluster members.java.util.concurrent.ExecutionException - when an error during execution occurs.java.lang.InterruptedException - when the processes is interrupted.public java.lang.String getProperty(java.lang.String name)
Note that just as with accessing shared state between threads, access to properties should be synchronized across all cluster members through some sort of locking mechanism.
getProperty in interface ClusterManagername - Name of the property.null if it is not set.public <T> T getProperty(java.lang.String name,
java.lang.Class<T> clazz)
The value of the property, if it exists, must be of the requested type. If it does not exist, or the value
does match the type, null is returned.
Note that just as with accessing shared state between threads, access to properties should be synchronized across all cluster members through some sort of locking mechanism.
getProperty in interface ClusterManagerT - Requested value type.name - Name of the property.clazz - Required class type of the property.null if it is not set or is not of the correct type.public <T> T getProperty(java.lang.String name,
java.lang.Class<T> clazz,
T defaultValue)
The value of the property, if it exists, must be of the requested type. If it does not exist, or the value does match the type, the default value is returned.
Note that just as with accessing shared state between threads, access to properties should be synchronized across all cluster members through some sort of locking mechanism.
getProperty in interface ClusterManagerT - Requested value type.name - Name of the property.clazz - Required class type of the property.defaultValue - Default value to return if the property isn't set or is of the wrong type.public void setProperty(java.lang.String name,
java.lang.Object value)
Note that just as with accessing shared state between threads, access to properties should be synchronized across all cluster members through some sort of locking mechanism.
setProperty in interface ClusterManagername - Name of the property.value - Value of the property.protected ClusterConfigurationProperties getClusterConfigurationProperties()