@ThreadSafe public class BlockingQueueMonitorNotificationService<T> extends java.lang.Object implements MonitorNotificationService<T>, java.util.function.Supplier<T>
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Brings this service to a state where it has disposed of its resources.
|
T |
get() |
void |
init()
Brings this service to a state where it is ready to process new publication requests.
|
boolean |
publish(java.nio.ByteBuffer dataBuffer,
TypeSupports.TypeSupport<T> typeSupport,
int dataCount)
Publishes a new value to a monitor's subscriber using a value that must
first be deserialized from the supplied data buffer.
|
boolean |
publish(T value)
Publishes a new value to a monitor's subscriber (which this library models as
a Java Consumer) using the value that is directly supplied.
|
public boolean publish(java.nio.ByteBuffer dataBuffer,
TypeSupports.TypeSupport<T> typeSupport,
int dataCount)
publish in interface MonitorNotificationService<T>dataBuffer - the byte buffer containing the new value (which must
first be deserialized).typeSupport - reference to an object which has the capability of
deserializing the information in the byte buffer.dataCount - the number of items in the buffer to be deserialized.java.lang.NullPointerException - if the passed value was null.public boolean publish(T value)
publish in interface MonitorNotificationService<T>value - the new value.java.lang.NullPointerException - if the passed value was null.public T get()
get in interface java.util.function.Supplier<T>public void init()
The implementation here does not need to do anything since the service leverages off a shared ThreadPoolExecutor whose lifecycle is managed outside the scope of this object's lifetime.
init in interface MonitorNotificationService<T>public void close()
The implementation here does not need to do anything since the service leverages off a shared ThreadPoolExecutor whose lifecycle is managed outside the scope of this object's lifetime.
close in interface java.lang.AutoCloseableclose in interface MonitorNotificationService<T>