public final class RepositoryChangeBus extends Object implements ChangeBus
RingBuffer| Modifier and Type | Class and Description |
|---|---|
protected class |
RepositoryChangeBus.ChangeSetListenerConsumerAdapter |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_RING_BUFFER_SIZE |
protected static Logger |
LOGGER |
| Constructor and Description |
|---|
RepositoryChangeBus(String repositoryName,
ExecutorService executor)
Creates a new change bus
|
RepositoryChangeBus(String repositoryName,
ExecutorService executor,
RepositoryStatistics statistics,
int bufferSize)
Creates a new change bus
|
| 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 observer)
Register the supplied observer.
|
boolean |
registerInThread(ChangeSetListener observer)
Register the supplied observer which will be always notified in the same thread as the bus instance.
|
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.
|
public static final int DEFAULT_RING_BUFFER_SIZE
protected static final Logger LOGGER
public RepositoryChangeBus(String repositoryName, ExecutorService executor)
repositoryName - the repository name; may not be nullexecutor - the ExecutorService which will be used internally to submit workers to
dispatching events to listeners.public RepositoryChangeBus(String repositoryName, ExecutorService executor, RepositoryStatistics statistics, int bufferSize)
repositoryName - the repository name; may not be nullexecutor - the ExecutorService which will be used internally to submit workers to
dispatching events to listeners.statistics - a RepositoryStatistics instance used to record various metrics; may be nullbufferSize - the total size of the ring bufferpublic boolean hasObservers()
ChangeBushasObservers in interface ChangeBustrue if there are any registered observers, false otherwisepublic boolean register(ChangeSetListener observer)
Observableregister in interface Observableobserver - the observer to be added; may be nullpublic boolean registerInThread(ChangeSetListener observer)
ChangeBusregisterInThread in interface ChangeBusobserver - the observer to be added; may be nullpublic boolean unregister(ChangeSetListener observer)
Observableunregister in interface Observableobserver - the observer to be removed; may not be nullpublic void start()
throws Exception
ChangeBuspublic void shutdown()
ChangeBusChangeBus.start()public void notify(ChangeSet changeSet)
ChangeSetListenernotify in interface ChangeSetListenerchangeSet - a non-null ChangeSetCopyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.