Package org.cyclos.impl.utils.cluster
Interface ClusterHandler
-
- All Superinterfaces:
CustomBean
- All Known Implementing Classes:
AbstractClusterHandlerImpl,HazelcastClusterHandlerImpl,NoClusterHandlerImpl
public interface ClusterHandler extends CustomBean
Handler for Cyclos 4 cluster, providing aspects like caches and task synchronization
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidawakePollingTasks(Set<PollingTask> pollingTasksToAwake)Awakes the givenPollingTasksCacheHandlerImplementorgetCacheHandler()Returns theCacheHandlermanaged by this clusterStringgetHostId()Returns the current host identifier<K,V>
LocalStorage<K,V>getLocalStorage(LocalStorageType<K,V> type)Returns the local storage for the given typePushNotificationHandlergetPushNotificationHandler()Returns thePushNotificationHandlerwhich can be used to publish / subscribe to push notification events<K extends Serializable,V extends Serializable>
SharedStorage<K,V>getSharedStorage(SharedStorageType<K,V> type)Returns a shared storage with a given namelonggetStartupTime()Returns when the cluster was started upbooleanisAlive()Returns whether the cluster (or local instance) is still alivebooleanisCluster()Returns whether we're actually running in a cluster or as a single node installationbooleanlockDatabase()Checks that there is no other Cyclos instance using the database and afterwards, locks the database.voidrunBackgroundTasks(List<Long> ids)Executes the background tasks with the given ids.booleanrunInitialization(ApplicationInitializationListener listener)Attempts to execute the givenApplicationInitializationListener#onApplicationInitialization(org.cyclos.impl.ApplicationHandler).booleanrunPollingTask(PollingTask task, boolean awake, Date nextExecution)Attempts to execute the givenPollingTask, except if it is already running in some other cluster node (in this case, returning false).
-
-
-
Method Detail
-
awakePollingTasks
void awakePollingTasks(Set<PollingTask> pollingTasksToAwake)
Awakes the givenPollingTasks
-
getCacheHandler
CacheHandlerImplementor getCacheHandler()
Returns theCacheHandlermanaged by this cluster
-
getHostId
String getHostId()
Returns the current host identifier
-
getLocalStorage
<K,V> LocalStorage<K,V> getLocalStorage(LocalStorageType<K,V> type)
Returns the local storage for the given type
-
getPushNotificationHandler
PushNotificationHandler getPushNotificationHandler()
Returns thePushNotificationHandlerwhich can be used to publish / subscribe to push notification events
-
getSharedStorage
<K extends Serializable,V extends Serializable> SharedStorage<K,V> getSharedStorage(SharedStorageType<K,V> type)
Returns a shared storage with a given name
-
getStartupTime
long getStartupTime()
Returns when the cluster was started up
-
isAlive
boolean isAlive()
Returns whether the cluster (or local instance) is still alive
-
isCluster
boolean isCluster()
Returns whether we're actually running in a cluster or as a single node installation
-
lockDatabase
boolean lockDatabase()
Checks that there is no other Cyclos instance using the database and afterwards, locks the database. Returns whether the database was actually locked.
-
runBackgroundTasks
void runBackgroundTasks(List<Long> ids)
Executes the background tasks with the given ids. TheCyclosProperties.getMaxBackgroundTasks()is respected.
-
runInitialization
boolean runInitialization(ApplicationInitializationListener listener)
Attempts to execute the givenApplicationInitializationListener#onApplicationInitialization(org.cyclos.impl.ApplicationHandler). In some cases (for example, the initialization was already executed), it might do nothing, and just return false
-
runPollingTask
boolean runPollingTask(PollingTask task, boolean awake, Date nextExecution)
Attempts to execute the givenPollingTask, except if it is already running in some other cluster node (in this case, returning false). TheCyclosProperties.getMaxBackgroundTasks()is respected.- Parameters:
task- The task to runawake- A flag indicating whether the given task has been manually awake (true) or is executing after a timeout (false)nextExecution- The date it is scheduled the next execution
-
-