public class BackgroundObserver extends Object implements Observer, Closeable
contentChanged(NodeState, CommitInfo)
method will never block,
regardless of the behavior of the other observer. If that observer blocks
or is too slow to consume all content changes, causing the change queue
to fill up, any further update will automatically be merged into just one
external content change, causing potential loss of local commit information.
To help prevent such cases, any sequential external content changes that
the background observer thread has yet to process are automatically merged
to just one change.Constructor and Description |
---|
BackgroundObserver(Observer observer,
Executor executor) |
BackgroundObserver(Observer observer,
Executor executor,
int queueLength) |
BackgroundObserver(Observer observer,
Executor executor,
int queueLength,
Thread.UncaughtExceptionHandler exceptionHandler) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Clears the change queue and signals the background thread to stop
without making any further
contentChanged(NodeState, CommitInfo)
calls to the background observer. |
void |
contentChanged(NodeState root,
CommitInfo info)
Observes a content change.
|
public BackgroundObserver(Observer observer, Executor executor, int queueLength, Thread.UncaughtExceptionHandler exceptionHandler)
public void close()
contentChanged(NodeState, CommitInfo)
calls to the background observer. If the thread is currently in the
middle of such a call, then that call is allowed to complete; i.e.
the thread is not forcibly interrupted. This method returns immediately
without blocking to wait for the thread to finish.
After a call to this method further calls to contentChanged(NodeState, CommitInfo)
will throw a IllegalStateException
.
close
in interface Closeable
close
in interface AutoCloseable
public void contentChanged(NodeState root, CommitInfo info)
Observer
Observer
class javadocs
and relevant repository and observer registration details for more
information on when and how this method gets called.contentChanged
in interface Observer
root
- root state of the repositoryinfo
- local commit information, or null
IllegalStateException
- if close()
has already been called."Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"