jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Jackrabbit Wiki] Update of "Observation" by ThomasMueller
Date Wed, 23 Sep 2009 07:05:23 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jackrabbit Wiki" for change notification.

The "Observation" page has been changed by ThomasMueller:

New page:
In addition to JCR observation, Jackrabbit support cluster-aware event processing and synchronous
observation listeners.

== Cluster-Aware Event Processing ==

Sometimes events must only be processed by the cluster node where the event originated, or
only by cluster nodes where the event didn't originate. Each event contains an 'external'
flag that indicated whether the event originated on another cluster node, that means whether
the code that manipulated the node ran in another cluster node. Example source code:

import org.apache.jackrabbit.api.observation.JackrabbitEvent;
public void onEvent(EventIterator events) {
    while (events.hasNext()) {
    Event e = events.nextEvent();
    if (e instanceof JackrabbitEvent && !((JackrabbitEvent) e).isExternal()) {
        // event originated in another cluster node
    } else {
        // event originated in this cluster node

== Synchronous Observation Listener ==

By default Jackrabbit call observation listeners some time after the event occurs.
However, synchronous observation is supported as well. To use it, the observation listener
needs to implement the interface org.apache.jackrabbit.core.observation.Synchronous``Event``Listener.
Please note that this interface is _not_ part of the Jackrabbit API, and should only
be used if really required.

View raw message