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()
ChangeBus
hasObservers
in interface ChangeBus
true
if there are any registered observers, false
otherwisepublic boolean register(ChangeSetListener observer)
Observable
register
in interface Observable
observer
- the observer to be added; may be nullpublic boolean registerInThread(ChangeSetListener observer)
ChangeBus
registerInThread
in interface ChangeBus
observer
- the observer to be added; may be nullpublic boolean unregister(ChangeSetListener observer)
Observable
unregister
in interface Observable
observer
- the observer to be removed; may not be nullpublic void start() throws Exception
ChangeBus
public void shutdown()
ChangeBus
ChangeBus.start()
public void notify(ChangeSet changeSet)
ChangeSetListener
notify
in interface ChangeSetListener
changeSet
- a non-null
ChangeSet
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.