Class SubscriptionHolder

java.lang.Object
org.ovirt.vdsm.jsonrpc.client.events.SubscriptionHolder

public class SubscriptionHolder extends Object
Holds subscription information such as amount of messages requested by EventSubscriber. When events are not processed immediately they are queued in here. This holder contains instance of subscription itself.
  • Field Details

  • Constructor Details

    • SubscriptionHolder

      public SubscriptionHolder(EventSubscriber subscriber)
      Creates a holder which subscriber instance and count and it prepares subscription id representation for event matching.
      Parameters:
      subscriber - Instance of @link EventSubscriber.
  • Method Details

    • getId

      public String getId()
      Returns:
      subscription id as complete string e.q. <receiver>.<component>.<operation_id>.<unique_id>.
    • getParsedId

      public String[] getParsedId()
      Returns:
      parsed subscription id as string array. Each entry represents subscription type.
    • filter

      private void filter()
    • getFilteredId

      public List<String> getFilteredId()
      Returns:
      Filtered subscription id which do not contains all filter '*'
    • canProcess

      public boolean canProcess()
      Returns:
      Checks and return information whether subscriber can process events based on count defined.
    • canProcessMore

      public JsonRpcEvent canProcessMore()
      Returns:
      An event for processing if there is any and if subscriber is willing to process more events.
    • putEvent

      public void putEvent(JsonRpcEvent event)
      Queues not processed event for later processing. When adding an event to the queue, set the arrival time of the event.
      Parameters:
      event - An event to be queued.
    • getNumberOfEvents

      public int getNumberOfEvents()
    • purgeOldEventsIfNotConsumed

      public void purgeOldEventsIfNotConsumed(int eventTimeoutInHours)
      Purge old events if they have not been consumed in a specified amount of time.
      Parameters:
      eventTimeoutInHours - the timeout after which the events are purged from the queue.
    • getSubscriber

      public EventSubscriber getSubscriber()
      Returns:
      Subscribed hold by this instance.
    • clean

      public void clean()
      Clean event queue.
    • incrementCount

      public long incrementCount(long n)