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
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceClusterHandler.FinishedExecutionsHandler
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidawakePollingTasks(Set<PollingTask> pollingTasksToAwake)Awakes the givenPollingTasksvoidfinishBackgroundTaskExecution(BackgroundTaskExecutionContext task)Masks as finished the given task executionMap<String,Integer>getBackgroundTaskExecutions()Returns a map from background task name to the number of executions it has.intgetBackgroundTasksQueueSize()Returns the current size of the background tasks queueCacheHandlerImplementorgetCacheHandler()Returns theCacheHandlermanaged by this clusterClusterHandler.FinishedExecutionsHandlergetFinishedBackgroundTaskExecutions()Returns a handler with the already finished executions at the moment of the invocation.StringgetHostId()Returns the current host identifier<K,V>
LocalStorage<K,V>getLocalStorage(LocalStorageType<K,V> type)Returns the local storage for the given typeMemberRunningTaskDescriptorgetMemberRunningTask(String taskName)Returns information with the member running the given polling task or null if the task is not being executed.List<ServerData>getMembersData()Returns information about each cluster member.
In caseisCluster()returns false then the list will contain a single element with the information of the local host.PollingTaskHandlerImplementorgetPollingTaskHandler()Returns thePollingTaskHandlermanaged by this clusterPushNotificationHandlergetPushNotificationHandler()Returns thePushNotificationHandlerwhich can be used to publish / subscribe to push notification eventsintgetRemainingBackgroundTaskCapacity()Returns number ofBackgroundTaskExecutionthe cluster can accept.<K extends Serializable,V extends Serializable>
ReplicatedStorage<K,V>getReplicatedStorage(ReplicatedStorageType type)Returns a simple storage with a given nameMap<String,MemberRunningTaskDescriptor>getRunningPollingTasks()Returns a map from polling task name to a descriptor with information about the member that is executing it.<K extends Serializable,V extends Serializable>
SharedStorage<K,V>getSharedStorage(SharedStorageType<K,V> type)Returns a shared storage with a given namebooleanisAlive()Returns whether the cluster (or local instance) is still alivebooleanisCausedByShutdown(Throwable e)Returns whether the given exception was caused by a server shutdown.booleanisCluster()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<BackgroundTaskExecutionContext> tasks)Executes the background tasks with the given ids.booleanrunInitialization(ApplicationInitializationListener listener)Attempts to execute the givenApplicationInitializationListener.onApplicationInitialization().booleanrunUpgradeInitialization(ApplicationUpgradeInitializationListener listener)Attempts to execute the givenApplicationUpgradeInitializationListener.onApplicationUpgradeInitialization().
-
-
-
Method Detail
-
awakePollingTasks
void awakePollingTasks(Set<PollingTask> pollingTasksToAwake)
Awakes the givenPollingTasks
-
finishBackgroundTaskExecution
void finishBackgroundTaskExecution(BackgroundTaskExecutionContext task)
Masks as finished the given task execution
-
getBackgroundTaskExecutions
Map<String,Integer> getBackgroundTaskExecutions()
Returns a map from background task name to the number of executions it has. A task no contained in the map means it's not running at the moment of the invocation.
-
getBackgroundTasksQueueSize
int getBackgroundTasksQueueSize()
Returns the current size of the background tasks queue
-
getCacheHandler
CacheHandlerImplementor getCacheHandler()
Returns theCacheHandlermanaged by this cluster
-
getFinishedBackgroundTaskExecutions
ClusterHandler.FinishedExecutionsHandler getFinishedBackgroundTaskExecutions()
Returns a handler with the already finished executions at the moment of the invocation.
-
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
-
getMemberRunningTask
MemberRunningTaskDescriptor getMemberRunningTask(String taskName)
Returns information with the member running the given polling task or null if the task is not being executed.
-
getMembersData
List<ServerData> getMembersData()
Returns information about each cluster member.
In caseisCluster()returns false then the list will contain a single element with the information of the local host.
-
getPollingTaskHandler
PollingTaskHandlerImplementor getPollingTaskHandler()
Returns thePollingTaskHandlermanaged by this cluster
-
getPushNotificationHandler
PushNotificationHandler getPushNotificationHandler()
Returns thePushNotificationHandlerwhich can be used to publish / subscribe to push notification events
-
getRemainingBackgroundTaskCapacity
int getRemainingBackgroundTaskCapacity()
Returns number ofBackgroundTaskExecutionthe cluster can accept.
-
getReplicatedStorage
<K extends Serializable,V extends Serializable> ReplicatedStorage<K,V> getReplicatedStorage(ReplicatedStorageType type)
Returns a simple storage with a given name
-
getRunningPollingTasks
Map<String,MemberRunningTaskDescriptor> getRunningPollingTasks()
Returns a map from polling task name to a descriptor with information about the member that is executing it. A task no contained in the map means it's not running at the moment of the invocation.
-
getSharedStorage
<K extends Serializable,V extends Serializable> SharedStorage<K,V> getSharedStorage(SharedStorageType<K,V> type)
Returns a shared storage with a given name
-
isAlive
boolean isAlive()
Returns whether the cluster (or local instance) is still alive
-
isCausedByShutdown
boolean isCausedByShutdown(Throwable e)
Returns whether the given exception was caused by a server shutdown. For example,InterruptedExceptions are considered to be caused by a shutdown.
-
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<BackgroundTaskExecutionContext> tasks)
Executes the background tasks with the given ids. TheCyclosProperties.getMaxBackgroundTasks()is respected.
-
runInitialization
boolean runInitialization(ApplicationInitializationListener listener)
Attempts to execute the givenApplicationInitializationListener.onApplicationInitialization(). In some cases (for example, the initialization was already executed), it might do nothing, and just return false
-
runUpgradeInitialization
boolean runUpgradeInitialization(ApplicationUpgradeInitializationListener listener)
Attempts to execute the givenApplicationUpgradeInitializationListener.onApplicationUpgradeInitialization(). In some cases (for example, the initialization was already executed), it might do nothing, and just return false
-
-