T - the element typepublic class LockedObserver<T> extends java.lang.Object implements Observer<T>, java.io.Closeable
| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.locks.Lock |
lock
The lock object.
|
protected Observer<? super T> |
observer
The wrapped observer.
|
| Constructor and Description |
|---|
LockedObserver(Observer<? super T> o)
Constructor, sets the wrapped observer and uses a fair ReentrantLock.
|
LockedObserver(Observer<? super T> o,
java.util.concurrent.locks.Lock l)
Constructor, sets the wrapped observer and uses the provided lock.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
error(java.lang.Throwable ex)
An exception is received.
|
void |
finish()
No more values to expect.
|
java.util.concurrent.locks.Lock |
getLock() |
void |
next(T value)
The next value is received.
|
public LockedObserver(@Nonnull
Observer<? super T> o)
o - the observerpublic java.util.concurrent.locks.Lock getLock()
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic void next(T value)
Observerpublic void error(@Nonnull
java.lang.Throwable ex)
BaseObservererror in interface BaseObserverex - the exceptionpublic void finish()
BaseObserverfinish in interface BaseObserver