Class JcrObservationThrottle

java.lang.Object
com.day.cq.commons.jcr.JcrObservationThrottle
All Implemented Interfaces:
EventListener

@Deprecated public class JcrObservationThrottle extends Object implements EventListener
Deprecated.
This was written for CRX single-threaded observation semantics but does not work with Oak which uses multiple threads for observation.
Used to wait until all queued observation events have been delivered, useful to throttle down operations that modify lots of nodes.
  • Constructor Summary

    Constructors
    Constructor
    Description
    JcrObservationThrottle(Node tempNodeFolder)
    Deprecated.
    Create a JcrObservationThrottle
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated.
    MUST be called to clean up, DELETES the temp folder node that was passed to constructor
    void
    Deprecated.
    This method is called when a bundle of events is dispatched.
    void
    Deprecated.
    Setup temporary node to detect events, must be called before {link #waitForEvents}
    long
    Deprecated.
    Block until all pending observation events have been delivered.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JcrObservationThrottle

      public JcrObservationThrottle(Node tempNodeFolder)
      Deprecated.
      Create a JcrObservationThrottle
      Parameters:
      tempNodeFolder - a node with a unique name is created in that folder to detect observation events.
  • Method Details

    • open

      public void open() throws RepositoryException
      Deprecated.
      Setup temporary node to detect events, must be called before {link #waitForEvents}
      Throws:
      RepositoryException - if some error occurs
    • close

      public void close()
      Deprecated.
      MUST be called to clean up, DELETES the temp folder node that was passed to constructor
    • onEvent

      public void onEvent(EventIterator events)
      Deprecated.
      Description copied from interface: EventListener
      This method is called when a bundle of events is dispatched.
      Specified by:
      onEvent in interface EventListener
      Parameters:
      events - The event set received.
    • waitForEvents

      public long waitForEvents() throws RepositoryException
      Deprecated.
      Block until all pending observation events have been delivered. As JCR events are delivered in order of their creation, simply creates a new temp node and waits for the corresponding event to be delivered. Note that the Session of the temporary folder node passed to the constructor is saved by this method, in order to create temporary nodes and detect their observation events.
      Returns:
      the elapsed time in msec for this method call.
      Throws:
      RepositoryException - if some error occurs