Class ClusterMessageServiceImpl
java.lang.Object
com.atlassian.crowd.manager.cluster.message.ClusterMessageServiceImpl
- All Implemented Interfaces:
ClusterMessageManager
,ClusterMessageService
,com.atlassian.scheduler.JobRunner
public class ClusterMessageServiceImpl
extends Object
implements ClusterMessageService, ClusterMessageManager, com.atlassian.scheduler.JobRunner
-
Constructor Summary
ConstructorDescriptionClusterMessageServiceImpl
(com.atlassian.scheduler.SchedulerService schedulerService, ClusterMessageDao dao, ClusterService clusterService, com.atlassian.event.api.EventPublisher eventPublisher, Supplier<Long> timestampSupplier) -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteMessagesOlderThan
(Instant instant) Removes all stored messages older than the specified instantvoid
Delete messages with timestamp older than an implementation-defined threshold.void
onApplicationStarted
(com.atlassian.config.lifecycle.events.ApplicationStartedEvent e) void
onXMLRestore
(XMLRestoreFinishedEvent restoreFinishedEvent) void
Send a message to other nodes (excluding the sender), notifying all listeners on a specific channel.void
registerListener
(ClusterMessageListener listener, String channel) Register a listener on a channel.void
com.atlassian.scheduler.JobRunnerResponse
runJob
(com.atlassian.scheduler.JobRunnerRequest request) void
start()
Start polling for new messages.void
stop()
Stop polling for new messages and ignore any late messages on start().void
unregisterListener
(ClusterMessageListener listener) Unregister a listener from all channels.void
unregisterListener
(ClusterMessageListener listener, String channel) Unregister a listener from a specific channel.void
-
Constructor Details
-
ClusterMessageServiceImpl
public ClusterMessageServiceImpl(com.atlassian.scheduler.SchedulerService schedulerService, ClusterMessageDao dao, ClusterService clusterService, com.atlassian.event.api.EventPublisher eventPublisher, Supplier<Long> timestampSupplier)
-
-
Method Details
-
registerSelf
@PostConstruct public void registerSelf() -
unregisterSelf
@PreDestroy public void unregisterSelf() -
onApplicationStarted
@EventListener public void onApplicationStarted(com.atlassian.config.lifecycle.events.ApplicationStartedEvent e) -
onXMLRestore
-
start
public void start()Description copied from interface:ClusterMessageManager
Start polling for new messages.- Specified by:
start
in interfaceClusterMessageManager
-
stop
public void stop()Description copied from interface:ClusterMessageManager
Stop polling for new messages and ignore any late messages on start().- Specified by:
stop
in interfaceClusterMessageManager
-
deleteOldMessages
public void deleteOldMessages()Description copied from interface:ClusterMessageManager
Delete messages with timestamp older than an implementation-defined threshold.- Specified by:
deleteOldMessages
in interfaceClusterMessageManager
-
deleteMessagesOlderThan
Description copied from interface:ClusterMessageManager
Removes all stored messages older than the specified instant- Specified by:
deleteMessagesOlderThan
in interfaceClusterMessageManager
-
registerListener
Description copied from interface:ClusterMessageService
Register a listener on a channel.- Specified by:
registerListener
in interfaceClusterMessageService
-
unregisterListener
Description copied from interface:ClusterMessageService
Unregister a listener from a specific channel.- Specified by:
unregisterListener
in interfaceClusterMessageService
-
unregisterListener
Description copied from interface:ClusterMessageService
Unregister a listener from all channels.- Specified by:
unregisterListener
in interfaceClusterMessageService
-
publish
Description copied from interface:ClusterMessageService
Send a message to other nodes (excluding the sender), notifying all listeners on a specific channel.- Specified by:
publish
in interfaceClusterMessageService
- Parameters:
channel
- channel name, max. 64 characters.message
- message content, max. 1024 characters.
-
runJob
@Nullable public com.atlassian.scheduler.JobRunnerResponse runJob(com.atlassian.scheduler.JobRunnerRequest request) - Specified by:
runJob
in interfacecom.atlassian.scheduler.JobRunner
-
getAllMessages
- Specified by:
getAllMessages
in interfaceClusterMessageManager
- Returns:
- all stored messages, including entries already processed or sent by the calling node.
-