Package nl.tue.id.oocsi.client.behavior
Class OOCSISpread
java.lang.Object
nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator<java.lang.Integer>
nl.tue.id.oocsi.client.behavior.OOCSISpread
public class OOCSISpread extends OOCSISystemCommunicator<java.lang.Integer>
OOCSISpread is a system-level primitive that allows for easy allocation of all OOCSI clients in a channel. The
allocation will be about a single key or data item, for which eventually an allocation is provided. This realizes a
distribution of roles that can be used to perform different tasks in a system.
- Author:
- matsfunk
-
Nested Class Summary
Nested classes/interfaces inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator
OOCSISystemCommunicator.SystemFilter<K>
-
Field Summary
Fields inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator
channelName, client, HANDLE
-
Constructor Summary
Constructors Constructor Description OOCSISpread(OOCSIClient client, java.lang.String channelName, java.lang.String key, int timeoutMS)
create a new OOCSI spreadOOCSISpread(OOCSIClient client, java.lang.String channelName, java.lang.String key, int timeoutMS, Handler handler)
create a new OOCSI spread with a handler that will be triggered once a stable allocation has been established -
Method Summary
Modifier and Type Method Description int
get()
return the current allocation of this instanceboolean
isDone()
return whether the allocation process is temporarily done (= no changes have occurred for a reasonable time)boolean
isRebalancing()
return whether period re-balancing of allocation is switched on or offvoid
reset()
reset the current allocationvoid
setRebalancing(boolean rebalancing)
switch periodic re-balancing of allocationMethods inherited from class nl.tue.id.oocsi.client.behavior.OOCSISystemCommunicator
addFilter, getHandle, message, message, message, subscribe, triggerHandler, updateFilter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
OOCSISpread
public OOCSISpread(OOCSIClient client, java.lang.String channelName, java.lang.String key, int timeoutMS)create a new OOCSI spread- Parameters:
client
-channelName
-key
-timeoutMS
-
-
OOCSISpread
public OOCSISpread(OOCSIClient client, java.lang.String channelName, java.lang.String key, int timeoutMS, Handler handler)create a new OOCSI spread with a handler that will be triggered once a stable allocation has been established- Parameters:
client
-channelName
-key
-timeoutMS
-handler
-
-
-
Method Details
-
reset
public void reset()reset the current allocation -
get
public int get()return the current allocation of this instance- Returns:
-
isDone
public boolean isDone()return whether the allocation process is temporarily done (= no changes have occurred for a reasonable time)- Returns:
-
isRebalancing
public boolean isRebalancing()return whether period re-balancing of allocation is switched on or off- Returns:
-
setRebalancing
public void setRebalancing(boolean rebalancing)switch periodic re-balancing of allocation- Parameters:
rebalancing
-
-