use of org.apache.jackrabbit.webdav.observation.EventBundle in project jackrabbit by apache.
the class SubscriptionImpl method discoverEvents.
/**
* Returns a {@link org.apache.jackrabbit.webdav.observation.EventDiscovery} object listing all events that were
* recorded since the last call to this method and clears the list of event
* bundles.
*
* @param timeout time in milliseconds to wait at most for events if none
* are present currently.
* @return object listing all events that were recorded.
* @see #onEvent(EventIterator)
*/
synchronized EventDiscovery discoverEvents(long timeout) {
EventDiscovery ed = new EventDiscovery();
if (eventBundles.isEmpty() && timeout > 0) {
try {
wait(timeout);
} catch (InterruptedException e) {
// continue and possibly return empty event discovery
}
}
for (EventBundle eb : eventBundles) {
ed.addEventBundle(eb);
}
// clear list
eventBundles.clear();
return ed;
}
Aggregations