Package com.day.cq.commons.jcr
Class JcrObservationThrottle
- java.lang.Object
-
- com.day.cq.commons.jcr.JcrObservationThrottle
-
- All Implemented Interfaces:
EventListener
@Deprecated public class JcrObservationThrottle extends java.lang.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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
close()
Deprecated.MUST be called to clean up, DELETES the temp folder node that was passed to constructorvoid
onEvent(EventIterator events)
Deprecated.This method is called when a bundle of events is dispatched.void
open()
Deprecated.Setup temporary node to detect events, must be called before {link #waitForEvents}long
waitForEvents()
Deprecated.Block until all pending observation events have been delivered.
-
-
-
Constructor Detail
-
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 Detail
-
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 interfaceEventListener
- 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
-
-