public interface ClusterHandler
extends org.cyclos.impl.CustomBean
| Modifier and Type | Method and Description |
|---|---|
void |
awakePollingTasks(java.util.Set<org.cyclos.impl.utils.tasks.PollingTask> pollingTasksToAwake)
Awakes the given
PollingTasks |
void |
blockUntilReady(java.lang.String key)
If there is a write block for the key then it blocks the current thread until the write lock is released.
Otherwise it do nothing. |
<T> T |
doWithSessionTimeoutMap(com.google.common.base.Function<java.util.Map<java.lang.String,java.lang.Long>,T> callback)
Runs the given function with access to the session timeout map, making sure the access to it is synchronized
|
org.cyclos.impl.utils.cache.CacheHandlerImplementor |
getCacheHandler()
Returns the
CacheHandler managed by this cluster |
java.lang.String |
getHostId()
Returns the current host identifier
|
java.util.Map<java.lang.String,java.lang.Long> |
getSessionTimeoutMap()
Returns the Map which stores the session timeouts
|
long |
getStartupTime()
Returns when the cluster was started up
|
boolean |
isAlive()
Returns whether the cluster (or local instance) is still alive
|
boolean |
isCluster()
Returns whether we're actually running in a cluster or as a single node installation
|
void |
runBackgroundTasks(java.util.List<java.lang.Long> ids)
Executes the background tasks with the given ids.
|
boolean |
runInitialization(org.cyclos.impl.ApplicationInitializationListener listener)
Attempts to execute the given
ApplicationInitializationListener#onApplicationInitialization(org.cyclos.impl.ApplicationHandler). |
boolean |
runPollingTask(org.cyclos.impl.utils.tasks.PollingTask task,
boolean awake)
Attempts to execute the given
PollingTask, except if it is already running in some other cluster node (in
this case, returning false). |
java.lang.Runnable |
writelock(java.lang.String key)
Locks the key for write (exclusive lock).
|
void awakePollingTasks(java.util.Set<org.cyclos.impl.utils.tasks.PollingTask> pollingTasksToAwake)
PollingTasksvoid blockUntilReady(java.lang.String key)
throws java.lang.InterruptedException
key - java.lang.InterruptedException<T> T doWithSessionTimeoutMap(com.google.common.base.Function<java.util.Map<java.lang.String,java.lang.Long>,T> callback)
org.cyclos.impl.utils.cache.CacheHandlerImplementor getCacheHandler()
CacheHandler managed by this clusterjava.lang.String getHostId()
java.util.Map<java.lang.String,java.lang.Long> getSessionTimeoutMap()
long getStartupTime()
boolean isAlive()
boolean isCluster()
void runBackgroundTasks(java.util.List<java.lang.Long> ids)
CyclosProperties.getMaxBackgroundTasks() is
respected.boolean runInitialization(org.cyclos.impl.ApplicationInitializationListener listener)
ApplicationInitializationListener#onApplicationInitialization(org.cyclos.impl.ApplicationHandler). In
some cases (for example, the initialization was already executed), it might do nothing, and just return falseboolean runPollingTask(org.cyclos.impl.utils.tasks.PollingTask task,
boolean awake)
PollingTask, except if it is already running in some other cluster node (in
this case, returning false).
The CyclosProperties.getMaxBackgroundTasks() is respected.task - The task to runawake - A flag indicating whether the given task has been manually awake (true) or is executing after a
timeout (false)java.lang.Runnable writelock(java.lang.String key)
Runnable instance that MUST be ran to release the lock.