org.modeshape.jcr.bus

## Class RepositoryChangeBus

- java.lang.Object
- - org.modeshape.jcr.bus.RepositoryChangeBus

- All Implemented Interfaces:
    ChangeBus, ChangeSetListener, Observable

      @ThreadSafe
      public final class RepositoryChangeBus
      extends Object
      implements ChangeBus

  A standard `ChangeBus` implementation.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static Logger` | `LOGGER`
    `protected boolean` | `shutdown`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RepositoryChangeBus(ExecutorService executor, String systemWorkspaceName)` Creates new change bus

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `hasObservers()` Checks if there are any observers registered with the bus.
    `void` | `notify(ChangeSet changeSet)` Notifies a listener of the given changes.
    `boolean` | `register(ChangeSetListener listener)` 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 listener)` 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

    - #### shutdown

          protected volatile boolean shutdown

  - ### Constructor Detail

    - #### RepositoryChangeBus

          public RepositoryChangeBus(ExecutorService executor,
                             String systemWorkspaceName)

      Creates new change bus
      Parameters:
        `executor` - the `ExecutorService` which will be used internally to submit workers to dispatching events to listeners.
        `systemWorkspaceName` - the name of the system workspace, needed because internal (system) events are dispatched in the same thread; may no be null

  - ### Method Detail

    - #### start

          public void start()

      Description copied from interface: `ChangeBus`
      Starts up the change bus.
      Specified by:
        `start` in interface `ChangeBus`

    - #### shutdown

          public void shutdown()

      Description copied from interface: `ChangeBus`
      Shuts down the change bus, closing and clearing resources created during `ChangeBus.start()`
      Specified by:
        `shutdown` in interface `ChangeBus`

    - #### register

          public boolean register(ChangeSetListener listener)

      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:
        `listener` - 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 listener)

      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:
        `listener` - 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

    - #### notify

          public void notify(ChangeSet changeSet)

      Description copied from interface: `ChangeSetListener`
      Notifies a listener of the given changes.
      Specified by:
        `notify` in interface `ChangeSetListener`
      Parameters:
        `changeSet` - a `non-null` `ChangeSet`

    - #### hasObservers

          public boolean hasObservers()

      Description copied from interface: `ChangeBus`
      Checks if there are any observers registered with the bus.
      Specified by:
        `hasObservers` in interface `ChangeBus`
      Returns:
        `true` if there are any registered observers, `false` otherwise

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