@ThreadSafe public final class ClusteredRepositoryChangeBus extends MessageConsumer<ChangeSet> implements ChangeBus
ChangeBus which can run in a cluster, via ClusteringService. This bus wraps around another
bus, to which it delegates all "local" processing of events.
It is important that the order of the ChangeSet instances are maintained across the
cluster, and JGroups will do this for us as long as we push all local changes into the channel and receive all local/remote
changes from the channel.
| Constructor and Description |
|---|
ClusteredRepositoryChangeBus(ChangeBus delegate,
ClusteringService clusteringService)
Creates a new clustered repository bus
|
| Modifier and Type | Method and Description |
|---|---|
void |
consume(ChangeSet changes)
Consumes a payload of the given type.
|
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.
|
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.
|
getPayloadTypepublic ClusteredRepositoryChangeBus(ChangeBus delegate, ClusteringService clusteringService)
delegate - the local bus to which changes will be delegatedclusteringService - the object which will handle sending/receiving information in the cluster.public void consume(ChangeSet changes)
MessageConsumerconsume in class MessageConsumer<ChangeSet>changes - a Serializable payload.public void start()
throws Exception
ChangeBuspublic boolean hasObservers()
ChangeBushasObservers in interface ChangeBustrue if there are any registered observers, false otherwisepublic void shutdown()
ChangeBusChangeBus.start()public void notify(ChangeSet changeSet)
ChangeSetListenernotify in interface ChangeSetListenerchangeSet - a non-null ChangeSetprotected final void logSendOperation(ChangeSet changeSet)
protected final void logReceivedOperation(ChangeSet changeSet)
public boolean register(ChangeSetListener observer)
Observableregister in interface Observableobserver - the observer to be added; may be nullpublic boolean unregister(ChangeSetListener observer)
Observableunregister in interface Observableobserver - the observer to be removed; may not be nullCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.