public interface ClusterManager
| Modifier and Type | Method and Description |
|---|---|
java.util.List<ClusterMember> |
getClusterMembers()
Returns the set of cluster members that will share workloads.
|
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.
|
<T> java.util.Map<ClusterMember,T> |
submitInstruction(Instruction<? extends T> instruction)
Submits an instruction to all cluster members.
|
<T> java.util.Map<ClusterMember,? extends T> |
submitInstructions(java.util.Map<ClusterMember,? extends Instruction<? extends T>> instructions)
Submits instructions to members of the cluster.
|
java.util.List<ClusterMember> getClusterMembers()
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.
name - Name of the property.null if it is not set.<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.
T - 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.<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.
T - 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.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.
name - Name of the property.value - Value of the property.<T> java.util.Map<ClusterMember,? extends T> submitInstructions(java.util.Map<ClusterMember,? extends Instruction<? extends T>> instructions) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
T - 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.<T> java.util.Map<ClusterMember,T> submitInstruction(Instruction<? extends T> instruction) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
T - 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.