T - the data type on whose changes is notifiedpublic interface Observable<T> extends Shutdownable
Shutdownable.ShutdownDeamon| Modifier and Type | Method and Description |
|---|---|
void |
addObserver(Observer<T> observer)
Method registers the given observer to this observable to get informed about value changes.
|
default T |
getLatestValue()
Deprecated.
please use
getValue() instead. |
T |
getValue()
Method returns the latest observable value.
|
Future<T> |
getValueFuture()
Method returns a Future object which represents the value availability.
|
boolean |
isValueAvailable()
Checks if a value was ever notified.
|
void |
removeObserver(Observer<T> observer)
Method removes the given observer from this observable to finish the observation.
|
default void |
waitForValue()
Method blocks until the observable is available.
|
void |
waitForValue(long timeout,
TimeUnit timeUnit)
Method blocks until the observable is available.
|
registerShutdownHook, registerShutdownHook, shutdownvoid waitForValue(long timeout,
TimeUnit timeUnit)
throws CouldNotPerformException,
InterruptedException
timeout - is the timeout related to the given TimeUnit.timeUnit - is the unit of the timeout.InterruptedException - is thrown if the current thread was interrupted externally.CouldNotPerformException - is thrown with a TimeoutException cause if the given timeout
is reached.default void waitForValue()
throws CouldNotPerformException,
InterruptedException
CouldNotPerformException - is thrown if an error occurs before the thread was blocked.InterruptedException - is thrown if the current thread was interrupted externally.void addObserver(Observer<T> observer)
observer - is the observer to register.void removeObserver(Observer<T> observer)
observer - is the observer to remove.T getValue() throws NotAvailableException
NotAvailableExceptionFuture<T> getValueFuture()
boolean isValueAvailable()
@Deprecated default T getLatestValue() throws NotAvailableException
getValue() instead.NotAvailableExceptionCopyright © 2015–2018 openbase.org. All rights reserved.