Package org.epics.ca.impl.monitor
Interface MonitorNotificationService<T>
-
- Type Parameters:
T- the type of the new value.
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
BlockingQueueMonitorNotificationService,DisruptorNewMonitorNotificationService,DisruptorOldMonitorNotificationService,StripedExecutorServiceMonitorNotificationService
public interface MonitorNotificationService<T> extends java.lang.AutoCloseableAn interface providing the ability to control a service whose job it is to publish new monitor notification events of a particular type to interested third party consumers (in EPICS terms the monitor's subscribers).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Brings this service to a state where it has disposed of its resources.voidinit()Brings this service to a state where it is ready to process new publication requests.booleanpublish(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.booleanpublish(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.
-
-
-
Method Detail
-
publish
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. This method places the responsibility of value deserialization on the service implementor. This provides the extra flexibility to reuse data structures and to avoid the cost of object creation.- Parameters:
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.- Returns:
- true when the new value was accepted without any loss of data; false if the oldest value in the notification buffer was discarded.
-
publish
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. The new value will be published to the Consumer on one or more notification threads. Where the subscriber is not immediately able to process it (eg the previous call to the Consumer is blocked) the value may optionally be buffered. If the value notification buffer becomes full the oldest value in the buffer is thrown away.- Parameters:
value- the new value.- Returns:
- true when the new value was accepted without any loss of data; false if the oldest value in the notification buffer was discarded.
-
init
void init()
Brings this service to a state where it is ready to process new publication requests.
-
close
void close()
Brings this service to a state where it has disposed of its resources. Threads that were created within the service are guaranteed to be destroyed.- Specified by:
closein interfacejava.lang.AutoCloseable
-
-