jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: Accessing repository from custom EventListener
Date Wed, 30 May 2007 10:42:08 GMT

On 5/30/07, Luca Tagliani <l.tagliani@prismaeng.it> wrote:
> Ok, I answered to myself...
> I can just pass the session to the constructor of my EventListener and
> use it during event processing.

One thing you should keep in mind is that you need to use a different
session than the one you registered the event listener with. The
events are delivered in a separate thread, which could cause the
original session to be accessed from multiple concurrent threads.

In fact the safest event processing model would be to have the event
listener placing the events (or copies of them, since at least the
Jackrabbit EventImpl class keeps and uses a references both to the
originating and listening sessions) in a synchronized event queue from
where the events are picked up and processed by a separate processing


Jukka Zitting

View raw message