Package org.cyclos.impl.utils.cluster
Class NoClusterHandlerImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractGlobalServerComponent
-
- org.cyclos.impl.BaseGlobalHandlerImpl
-
- org.cyclos.impl.utils.cluster.AbstractClusterHandlerImpl
-
- org.cyclos.impl.utils.cluster.NoClusterHandlerImpl
-
- All Implemented Interfaces:
CustomBean,ClusterHandler
public class NoClusterHandlerImpl extends AbstractClusterHandlerImpl
AClusterHandlerfor standalone instances (no cluster)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.cyclos.impl.utils.cluster.AbstractClusterHandlerImpl
AbstractClusterHandlerImpl.FinishedExecutionsHandlerImpl
-
Nested classes/interfaces inherited from interface org.cyclos.impl.utils.cluster.ClusterHandler
ClusterHandler.FinishedExecutionsHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected ConversionHandlerconversionHandler-
Fields inherited from class org.cyclos.impl.utils.cluster.AbstractClusterHandlerImpl
applicationContext, backgroundTaskHandler, beanHandler, cyclosProperties, databaseManager, dbLockHandler, IGNORE_DB_LOCK_PROPERTY, ignoreDbLock, invokerHandler, lockHandler, nativeQueryHandler, pollingTaskHandler, rawEntityManagerHandler, systemMonitorService
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description NoClusterHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoRemoveFinishedBackgroundTaskExecutions(List<Long> ids)voidfinishBackgroundTaskExecution(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.protected BlockingQueue<BackgroundTaskExecutionContext>getBackgroundTaskQueue()protected intgetBackgroundTaskThreads()ClusterHandler.FinishedExecutionsHandlergetFinishedBackgroundTaskExecutions()Returns a handler with the already finished executions at the moment of the invocation.StringgetHostId()Returns the current host identifierMemberRunningTaskDescriptorgetMemberRunningTask(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 caseClusterHandler.isCluster()returns false then the list will contain a single element with the information of the local host.Map<String,MemberRunningTaskDescriptor>getRunningPollingTasks()Returns a map from polling task name to a descriptor with information about the member that is executing it.voidinitialize()protected CacheHandlerImplementorinstantiateCacheHandler()protected PollingTaskHandlerImplementorinstantiatePollingTaskHandler()protected PushNotificationHandlerinstantiatePushNotificationHandler()booleanisAlive()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.protected voidrunBackgroundTask(BackgroundTaskExecutionContext task)protected booleanshouldEnsureDatabaseIsNotLocked()protected booleanshouldUnlockDatabase()voidshutdown()-
Methods inherited from class org.cyclos.impl.utils.cluster.AbstractClusterHandlerImpl
awakePollingTasks, createLocalStorage, createReplicatedStorage, createSharedStorage, getBackgroundTasksQueueSize, getCacheHandler, getLocalStorage, getPollingTaskHandler, getPushNotificationHandler, getRemainingBackgroundTaskCapacity, getReplicatedStorage, getSharedStorage, isCausedByShutdown, runBackgroundTasks, runInitialization, runUpgradeInitialization
-
Methods inherited from class org.cyclos.impl.AbstractGlobalServerComponent
getBaseEntityManagerHandler, getEntityManager
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Field Detail
-
conversionHandler
@Autowired @Lazy protected ConversionHandler conversionHandler
-
-
Method Detail
-
finishBackgroundTaskExecution
public void finishBackgroundTaskExecution(BackgroundTaskExecutionContext task)
Description copied from interface:ClusterHandlerMasks as finished the given task execution
-
getBackgroundTaskExecutions
public Map<String,Integer> getBackgroundTaskExecutions()
Description copied from interface:ClusterHandlerReturns 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.
-
getFinishedBackgroundTaskExecutions
public ClusterHandler.FinishedExecutionsHandler getFinishedBackgroundTaskExecutions()
Description copied from interface:ClusterHandlerReturns a handler with the already finished executions at the moment of the invocation.
-
getHostId
public String getHostId()
Description copied from interface:ClusterHandlerReturns the current host identifier
-
getMemberRunningTask
public MemberRunningTaskDescriptor getMemberRunningTask(String taskName)
Description copied from interface:ClusterHandlerReturns information with the member running the given polling task or null if the task is not being executed.
-
getMembersData
public List<ServerData> getMembersData()
Description copied from interface:ClusterHandlerReturns information about each cluster member.
In caseClusterHandler.isCluster()returns false then the list will contain a single element with the information of the local host.
-
getRunningPollingTasks
public Map<String,MemberRunningTaskDescriptor> getRunningPollingTasks()
Description copied from interface:ClusterHandlerReturns 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.
-
initialize
@PostConstruct public void initialize()
- Overrides:
initializein classAbstractClusterHandlerImpl
-
isAlive
public boolean isAlive()
Description copied from interface:ClusterHandlerReturns whether the cluster (or local instance) is still alive
-
isCluster
public boolean isCluster()
Description copied from interface:ClusterHandlerReturns whether we're actually running in a cluster or as a single node installation
-
lockDatabase
public boolean lockDatabase()
Description copied from interface:ClusterHandlerChecks that there is no other Cyclos instance using the database and afterwards, locks the database. Returns whether the database was actually locked.- Specified by:
lockDatabasein interfaceClusterHandler- Overrides:
lockDatabasein classAbstractClusterHandlerImpl
-
shutdown
@PreDestroy public void shutdown()
- Overrides:
shutdownin classAbstractClusterHandlerImpl
-
doRemoveFinishedBackgroundTaskExecutions
protected void doRemoveFinishedBackgroundTaskExecutions(List<Long> ids)
- Specified by:
doRemoveFinishedBackgroundTaskExecutionsin classAbstractClusterHandlerImpl
-
getBackgroundTaskQueue
protected BlockingQueue<BackgroundTaskExecutionContext> getBackgroundTaskQueue()
- Specified by:
getBackgroundTaskQueuein classAbstractClusterHandlerImpl
-
getBackgroundTaskThreads
protected int getBackgroundTaskThreads()
- Specified by:
getBackgroundTaskThreadsin classAbstractClusterHandlerImpl
-
instantiateCacheHandler
protected CacheHandlerImplementor instantiateCacheHandler()
- Specified by:
instantiateCacheHandlerin classAbstractClusterHandlerImpl
-
instantiatePollingTaskHandler
protected PollingTaskHandlerImplementor instantiatePollingTaskHandler()
- Specified by:
instantiatePollingTaskHandlerin classAbstractClusterHandlerImpl
-
instantiatePushNotificationHandler
protected PushNotificationHandler instantiatePushNotificationHandler()
- Specified by:
instantiatePushNotificationHandlerin classAbstractClusterHandlerImpl
-
runBackgroundTask
protected void runBackgroundTask(BackgroundTaskExecutionContext task)
- Overrides:
runBackgroundTaskin classAbstractClusterHandlerImpl
-
shouldEnsureDatabaseIsNotLocked
protected boolean shouldEnsureDatabaseIsNotLocked()
- Specified by:
shouldEnsureDatabaseIsNotLockedin classAbstractClusterHandlerImpl
-
shouldUnlockDatabase
protected boolean shouldUnlockDatabase()
- Specified by:
shouldUnlockDatabasein classAbstractClusterHandlerImpl
-
-