ModeShape Distribution 3.0.0.Beta4

org.modeshape.jcr.bus
Class ClusteredRepositoryChangeBus

java.lang.Object
  extended by org.modeshape.jcr.bus.ClusteredRepositoryChangeBus
All Implemented Interfaces:
ChangeBus, ChangeSetListener, Observable

@ThreadSafe
public final class ClusteredRepositoryChangeBus
extends Object
implements ChangeBus

Implementation of a ChangeBus which can run in a cluster, via JGroups. This bus wraps around another bus, to which it delegates all "local" processing of events.


Nested Class Summary
protected  class ClusteredRepositoryChangeBus.Listener
           
protected  class ClusteredRepositoryChangeBus.Receiver
           
 
Field Summary
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 Summary
ClusteredRepositoryChangeBus(RepositoryConfiguration.Clustering clusteringConfiguration, ChangeBus delegate)
           
 
Method Summary
protected static ChangeSet deserialize(byte[] data)
           
 boolean hasObservers()
           
 boolean isStarted()
          Return whether this bus has been started and not yet shut down.
protected  void logReceivedOperation(ChangeSet changeSet)
           
protected  void logSendOperation(ChangeSet changeSet)
           
 void notify(ChangeSet changeSet)
           
 boolean register(ChangeSetListener observer)
          Register the supplied observer.
protected static byte[] serialize(ChangeSet changes)
           
 void shutdown()
           
 void start()
           
 boolean unregister(ChangeSetListener observer)
          Unregister the supplied observer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final Logger LOGGER

delegate

protected final ChangeBus delegate
The wrapped standalone bus to which standard bus operations are delegated


isOpen

protected final AtomicBoolean isOpen
Flag that dictates whether this bus has connected to the cluster.


multipleAddressesInCluster

protected final 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.


clusteringConfiguration

protected final RepositoryConfiguration.Clustering clusteringConfiguration
The clustering configuration

Constructor Detail

ClusteredRepositoryChangeBus

public ClusteredRepositoryChangeBus(RepositoryConfiguration.Clustering clusteringConfiguration,
                                    ChangeBus delegate)
Method Detail

start

public void start()
Specified by:
start in interface ChangeBus

hasObservers

public boolean hasObservers()
Specified by:
hasObservers in interface ChangeBus

isStarted

public boolean isStarted()
Return whether this bus has been started and not yet shut down.

Returns:
true if start() has been called but shutdown() has not, or false otherwise

shutdown

public void shutdown()
Specified by:
shutdown in interface ChangeBus

notify

public void notify(ChangeSet changeSet)
Specified by:
notify in interface ChangeSetListener

logSendOperation

protected final void logSendOperation(ChangeSet changeSet)

logReceivedOperation

protected final void logReceivedOperation(ChangeSet changeSet)

register

public boolean register(ChangeSetListener observer)
Description copied from interface: Observable
Register the supplied observer. This method does nothing if the observer reference is null.

Specified by:
register in interface Observable
Parameters:
observer - the observer to be added; may be null
Returns:
true if the observer was added, or false if the observer was null, if the observer was already registered, or if the observer could not be added

unregister

public boolean unregister(ChangeSetListener observer)
Description copied from interface: Observable
Unregister the supplied observer. This method does nothing if the observer reference is null.

Specified by:
unregister in interface Observable
Parameters:
observer - the observer to be removed; may not be null
Returns:
true if the observer was removed, or false if the observer was null or if the observer was not registered on this source

serialize

protected static byte[] serialize(ChangeSet changes)
                           throws Exception
Throws:
Exception

deserialize

protected static ChangeSet deserialize(byte[] data)
                                throws Exception
Throws:
Exception

ModeShape Distribution 3.0.0.Beta4

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.