jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luca Tagliani <l.tagli...@prismaeng.it>
Subject Re: Accessing repository from custom EventListener
Date Wed, 30 May 2007 10:55:19 GMT

Hi Jukka,
  I thought I can use the same session (shared by the different threads) as
long as the only operations on the repository are "READ" operations.

Do you agree?

BR

Luca Tagliani


Jukka Zitting wrote:
> 
> Hi,
> 
> 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
> thread.
> 
> BR,
> 
> Jukka Zitting
> 
> 

-- 
View this message in context: http://www.nabble.com/Accessing-repository-from-custom-EventListener-tf3839360.html#a10871374
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message