Class DisruptorOldMonitorNotificationService<T>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Brings this service to a state where it has disposed of its resources.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • publish

        public 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.
        Specified by:
        publish in interface MonitorNotificationService<T>
        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

        public 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.
        Specified by:
        publish in interface MonitorNotificationService<T>
        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

        public void init()
        Brings this service to a state where it is ready to process new publication requests. The implementation here starts a single thread to take events off the Disruptor RingBuffer and to publish them to the Consumer.
        Specified by:
        init in interface MonitorNotificationService<T>
      • close

        public 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:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface MonitorNotificationService<T>