Class ConfluenceDirectoryEventListener
- java.lang.Object
-
- com.atlassian.confluence.user.crowd.ConfluenceDirectoryEventListener
-
- All Implemented Interfaces:
EventListener
,org.springframework.context.ApplicationListener
public final class ConfluenceDirectoryEventListener extends Object implements org.springframework.context.ApplicationListener
PropagatesDirectoryUpdatedEvent
andDirectoryDeletedEvent
to other nodes in a cluster to trigger the relevant updates to caches and directory monitors on each node.When this listener receives one of those events, it is wrapped and republished via
ClusterManager.publishEvent(ConfluenceEvent)
. The same listener on the other nodes receives the cluster wrapper event, unwraps the original event and republishes it.Republished events have a
null
source to distinguish them from original events occurring on the the local node.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConfluenceDirectoryEventListener.ClusterDirectoryDeletedEvent
protected static class
ConfluenceDirectoryEventListener.ClusterDirectoryEvent
Crowd's event classes are not Serializable, so we need to extract the event class and directory, then reconstruct the event on the other nodes.static class
ConfluenceDirectoryEventListener.ClusterDirectoryUpdatedEvent
-
Constructor Summary
Constructors Constructor Description ConfluenceDirectoryEventListener(ClusterManager clusterManager, com.atlassian.event.api.EventPublisher eventPublisher, org.springframework.transaction.PlatformTransactionManager transactionManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
handleEventOnThisNode(com.atlassian.crowd.event.directory.DirectoryDeletedEvent directoryDeletedEvent)
Handles directory modification events on the current node, republishing this to other nodes in the cluster once the current transaction is complete.void
handleEventOnThisNode(com.atlassian.crowd.event.directory.DirectoryUpdatedEvent directoryUpdatedEvent)
Handles directory modification events on the current node, republishing this to other nodes in the cluster once the current transaction is complete.void
init()
void
onApplicationEvent(org.springframework.context.ApplicationEvent event)
Handles cluster events from other nodes.
-
-
-
Constructor Detail
-
ConfluenceDirectoryEventListener
public ConfluenceDirectoryEventListener(ClusterManager clusterManager, com.atlassian.event.api.EventPublisher eventPublisher, org.springframework.transaction.PlatformTransactionManager transactionManager)
-
-
Method Detail
-
init
@PostConstruct public void init()
-
handleEventOnThisNode
@EventListener public void handleEventOnThisNode(com.atlassian.crowd.event.directory.DirectoryDeletedEvent directoryDeletedEvent)
Handles directory modification events on the current node, republishing this to other nodes in the cluster once the current transaction is complete.
-
handleEventOnThisNode
@EventListener public void handleEventOnThisNode(com.atlassian.crowd.event.directory.DirectoryUpdatedEvent directoryUpdatedEvent)
Handles directory modification events on the current node, republishing this to other nodes in the cluster once the current transaction is complete.
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
Handles cluster events from other nodes.Assumes that the call to
ClusterManager.publishEvent(ConfluenceEvent)
above actually ends up invoking the legacy EventManager on all nodes to publish a SpringApplicationEvent
with the relevant information.- Specified by:
onApplicationEvent
in interfaceorg.springframework.context.ApplicationListener
-
-