Class DXAeronSubscriptionChecker


  • public class DXAeronSubscriptionChecker
    extends java.lang.Object
    This class lets to support async-style cursor API (availability listeners) with Aeron.

    Problem: Aeron does not provide "new data callbacks". To check if data available we must actively poll subscription. So to support our async cursor API we need to have additional thread(s) to do that. To reduce thread overhead we use single thread to check all subscriptions for all cursors in single client (TickDBClient) instance.

    Some cursors are low latency cursors. If we have at least one low latency cursor that wants to use aync API we should not let thread sleep or wait. To track such cursory they mist be registered via registerCritical(Object).

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addSubscriptionToCheck​(io.aeron.Subscription subscription, java.lang.Runnable listener)
      Adds subscription to be polled by "checker" thread.
      void registerCritical​(java.lang.Object criticalSubscriber)
      This method can be used to register latency critical cursors
      void stop()  
      void unregisterCritical​(java.lang.Object criticalSubscriber)  
      • Methods inherited from class java.lang.Object

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

      • DXAeronSubscriptionChecker

        public DXAeronSubscriptionChecker()
    • Method Detail

      • addSubscriptionToCheck

        public void addSubscriptionToCheck​(io.aeron.Subscription subscription,
                                           java.lang.Runnable listener)
        Adds subscription to be polled by "checker" thread. Checker thread will call the listener one time as soon as there is new data. Then "checker" will stop polling this subscription.
        Parameters:
        subscription - subscription to check
        listener - listener to call when there is new data
      • registerCritical

        public void registerCritical​(java.lang.Object criticalSubscriber)
        This method can be used to register latency critical cursors
        Parameters:
        criticalSubscriber - any object that represents latency critical context
      • unregisterCritical

        public void unregisterCritical​(java.lang.Object criticalSubscriber)
      • stop

        public void stop()