org.modeshape.repository.cluster
Class ClusteringService

java.lang.Object
  extended by org.modeshape.repository.cluster.ClusteringService
All Implemented Interfaces:
Observable, ObservationBus, Observer, AdministeredService

public class ClusteringService
extends Object
implements AdministeredService, ObservationBus

The service that provides the observation bus for a clustered (or unclustered) environment.


Nested Class Summary
protected  class ClusteringService.Administrator
          The administrative component for this service.
 
Constructor Summary
ClusteringService()
           
 
Method Summary
protected  ClusteringConfig createDefaultConfiguration()
           
 ServiceAdministrator getAdministrator()
          
 ExecutionContext getExecutionContext()
           
 boolean hasObservers()
          Determine whether this particular bus currently has any observers.
protected  boolean isServiceTerminated()
           
 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.
 boolean setClusteringConfig(ClusteringConfig config)
          Set the configuration for the clustering.
 void setExecutionContext(ExecutionContext executionContext)
           
 void shutdown()
          Unregister all registered observers, and mark this as no longer accepting new registered observers.
protected  void shutdownService()
           
 void start()
          Prepare this bus for operation by starting any resources.
protected  void startService()
           
 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
 

Constructor Detail

ClusteringService

public ClusteringService()
Method Detail

getExecutionContext

public ExecutionContext getExecutionContext()
Returns:
executionContext

setExecutionContext

public void setExecutionContext(ExecutionContext executionContext)
Parameters:
executionContext - Sets executionContext to the specified value.

setClusteringConfig

public boolean setClusteringConfig(ClusteringConfig config)
Set the configuration for the clustering. This method will replace any existing configuration.

Parameters:
config - the new configuration, or null if the default configuration should be used
Returns:
true if the configuration was set, or false otherwise

hasObservers

public boolean hasObservers()
Determine whether this particular bus currently has any observers.

Specified by:
hasObservers in interface ObservationBus
Returns:
true if there is at least one observer, or false otherwise
See Also:
ObservationBus.hasObservers()

register

public boolean register(Observer observer)
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
See Also:
Observable.register(org.modeshape.graph.observe.Observer)

unregister

public boolean unregister(Observer observer)
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
See Also:
Observable.unregister(org.modeshape.graph.observe.Observer)

notify

public void notify(Changes changes)
Method that is called for each set of changes from the Observable instance(s) with which this observer is registered.

Specified by:
notify in interface Observer
Parameters:
changes - the changes that are being published
See Also:
Observer.notify(org.modeshape.graph.observe.Changes)

getAdministrator

public ServiceAdministrator getAdministrator()

Specified by:
getAdministrator in interface AdministeredService
See Also:
AdministeredService.getAdministrator()

start

public void start()
Prepare this bus for operation by starting any resources.

This is equivalent to calling getAdminstrator().start() and can be called multiple times.

Specified by:
start in interface ObservationBus
See Also:
ObservationBus.start()

shutdown

public void shutdown()
Unregister all registered observers, and mark this as no longer accepting new registered observers.

This is equivalent to calling getAdminstrator().shutdown().

Specified by:
shutdown in interface ObservationBus
See Also:
ObservationBus.shutdown()

startService

protected void startService()

shutdownService

protected void shutdownService()

isServiceTerminated

protected boolean isServiceTerminated()

createDefaultConfiguration

protected ClusteringConfig createDefaultConfiguration()


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