|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.clustering.ClusteredObservationBus
public class ClusteredObservationBus
An implementation of a cluster-aware ObservationBus
.
Nested Class Summary | |
---|---|
protected class |
ClusteredObservationBus.Listener
|
protected class |
ClusteredObservationBus.Receiver
|
Field Summary | |
---|---|
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 propogated only to the local observers. |
protected ChangeObservers |
observers
The list of Observer instances that should receive events from the bus. |
Constructor Summary | |
---|---|
ClusteredObservationBus()
|
Method Summary | |
---|---|
protected static Changes |
deserialize(byte[] data)
|
String |
getClusterName()
Get the name of the JGroups cluster. |
String |
getConfiguration()
Get the configuration for JGroups. |
boolean |
hasObservers()
Determine whether this particular bus currently has any observers. |
boolean |
isStarted()
Return whether this bus has been started and not yet shut down . |
protected org.jgroups.JChannel |
newChannel(String configuration)
A method that is used to instantiate the JChannel object with the supplied configuration. |
void |
notify(Changes changes)
Method that is called for each set of changes from the Observable instance(s) with which this
observer is registered. |
boolean |
register(Observer observer)
Register the supplied observer. |
protected static byte[] |
serialize(Changes changes)
|
void |
setClusterName(String clusterName)
Set the name of the JGroups cluster. |
void |
setConfiguration(String configuration)
Set the JGroups configuration, which may be a string that refers to a resource on the classpath, the path of the local configuration, the URL to the configuration file, or the configuration specified using the newer-style XML form or older-style string form. |
void |
shutdown()
Unregister all registered observers, and mark this as no longer accepting new registered observers. |
void |
start()
Prepare this bus for operation by starting any resources. |
boolean |
unregister(Observer 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 |
---|
protected static final Logger LOGGER
protected final ChangeObservers observers
Observer
instances that should receive events from the bus. These Observer objects are all local.
protected final AtomicBoolean isOpen
protected final AtomicBoolean multipleAddressesInCluster
Constructor Detail |
---|
public ClusteredObservationBus()
Method Detail |
---|
public String getConfiguration()
public void setConfiguration(String configuration)
configuration
- the relative path to a classpath resource, path to a local file, URL to the configuration file, or the
configuration specified using the newer-style XML form or older-style string form.
IllegalStateException
- if this method is called after this bus has been started
but before it has
been shutdown
public String getClusterName()
JChannel.connect(String)
public void setClusterName(String clusterName)
start()
is called.
clusterName
- Sets clusterName to the specified value.
IllegalStateException
- if this method is called after this bus has been started
but before it has
been shutdown
JChannel.connect(String)
public void start()
start
in interface ObservationBus
ObservationBus.start()
protected org.jgroups.JChannel newChannel(String configuration) throws org.jgroups.ChannelException
JChannel
object with the supplied configuration. Subclasses can override
this method to specialize this behavior.
configuration
- the configuration; may be null or empty string, if the default configuration should be used
org.jgroups.ChannelException
- if there is a problem creating the new channel objectpublic void notify(Changes changes)
set of changes
from the Observable
instance(s) with which this
observer is registered.
notify
in interface Observer
changes
- the changes that are being publishedObserver.notify(org.modeshape.graph.observe.Changes)
public boolean register(Observer observer)
register
in interface Observable
observer
- the observer to be added; may be null
Observable.register(org.modeshape.graph.observe.Observer)
public boolean unregister(Observer observer)
unregister
in interface Observable
observer
- the observer to be removed; may not be null
Observable.unregister(org.modeshape.graph.observe.Observer)
public boolean hasObservers()
hasObservers
in interface ObservationBus
ObservationBus.hasObservers()
public boolean isStarted()
started
and not yet shut down
.
start()
has been called but shutdown()
has not, or false otherwisepublic void shutdown()
shutdown
in interface ObservationBus
ObservationBus.shutdown()
protected static byte[] serialize(Changes changes) throws Exception
Exception
protected static Changes deserialize(byte[] data) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |