@ThreadSafe public final class ClusteredRepositoryChangeBus extends Object implements ChangeBus
ChangeBus
which can run in a cluster, via JGroups. This bus wraps around another bus, to which it
delegates all "local" processing of events.Modifier and Type | Class and Description |
---|---|
protected class |
ClusteredRepositoryChangeBus.Listener |
protected class |
ClusteredRepositoryChangeBus.ObjectInputStreamWithClassLoader
ObjectInputStream extension that allows a different class loader to be used when resolving types.
|
protected class |
ClusteredRepositoryChangeBus.Receiver |
Modifier and Type | Field and Description |
---|---|
protected RepositoryConfiguration.Clustering |
clusteringConfiguration
The clustering configuration
|
protected ChangeBus |
delegate
The wrapped standalone bus to which standard bus operations are delegated
|
protected AtomicBoolean |
isOpen
Flag that dictates whether this bus has connected to the cluster.
|
protected static Logger |
LOGGER |
protected AtomicBoolean |
multipleAddressesInCluster
Flag that dictates whether there are multiple participants in the cluster; if not, then the changes are propagated only to
the local observers.
|
Constructor and Description |
---|
ClusteredRepositoryChangeBus(RepositoryConfiguration.Clustering clusteringConfiguration,
ChangeBus delegate,
String processId)
Creates a new clustered repository bus
|
Modifier and Type | Method and Description |
---|---|
protected ChangeSet |
deserialize(byte[] data) |
boolean |
hasObservers()
Checks if there are any observers registered with the bus.
|
protected void |
logReceivedOperation(ChangeSet changeSet) |
protected void |
logSendOperation(ChangeSet changeSet) |
void |
notify(ChangeSet changeSet)
Notifies a listener of the given changes.
|
boolean |
register(ChangeSetListener observer)
Register the supplied observer.
|
protected byte[] |
serialize(ChangeSet changes) |
void |
shutdown()
Shuts down the change bus, closing and clearing resources created during
ChangeBus.start() |
void |
start()
Starts up the change bus.
|
boolean |
unregister(ChangeSetListener observer)
Unregister the supplied observer.
|
protected static final Logger LOGGER
protected final ChangeBus delegate
protected final AtomicBoolean isOpen
protected final AtomicBoolean multipleAddressesInCluster
protected final RepositoryConfiguration.Clustering clusteringConfiguration
public ClusteredRepositoryChangeBus(RepositoryConfiguration.Clustering clusteringConfiguration, ChangeBus delegate, String processId)
clusteringConfiguration
- the bus configurationdelegate
- the local bus to which changes will be delegatedprocessId
- the id of the process which started this buspublic void start() throws Exception
ChangeBus
public boolean hasObservers()
ChangeBus
hasObservers
in interface ChangeBus
true
if there are any registered observers, false
otherwisepublic void shutdown()
ChangeBus
ChangeBus.start()
public void notify(ChangeSet changeSet)
ChangeSetListener
notify
in interface ChangeSetListener
changeSet
- a non-null
ChangeSet
protected final void logSendOperation(ChangeSet changeSet)
protected final void logReceivedOperation(ChangeSet changeSet)
public boolean register(ChangeSetListener observer)
Observable
register
in interface Observable
observer
- the observer to be added; may be nullpublic boolean unregister(ChangeSetListener observer)
Observable
unregister
in interface Observable
observer
- the observer to be removed; may not be nullCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.