You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Daniel Sbityakov <ds...@gmail.com> on 2011/03/02 02:18:55 UTC

Persistent Observation Listeners

Hello all. I'm having a conceptual problem with observation event mechanism.

It appears that any event listener A opened by session B will be
disconnected from the observation facility when B is closed.  This is
somewhat odd, because you add event listeners to a workspace-bound
observation manager, not to a session.  However, jackrabbit
implementation uses the observation mechanism extensively, but using
internal "system" sessions, which, I'm guessing, are never closed.

What is the best practice that you all can recommend when you need
long-running listeners without the overhead of keeping sessions
opened?  Or do we follow jackrabbit example and squirrel some sessions
away and keep them open to keep the observation events communication
flowing?
Please advise.

Thank you!

Re: Persistent Observation Listeners

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

IIRC it is prescribed by the JCR spec that observation listener
registration is bounded by the Session life cycle. One of the reasons
for this is that observation events are filtered by access control.

So, yes, we keep the sessions open for as long as we have an observation
listener registered. An Session will generally not have a big memory
footprint -- if it has such used memory can be collected over time. The
biggest problem would probably be if the Session would keep uncommitted
changes longer than required....

Regards
Felix

Am Dienstag, den 01.03.2011, 20:18 -0500 schrieb Daniel Sbityakov: 
> Hello all. I'm having a conceptual problem with observation event mechanism.
> 
> It appears that any event listener A opened by session B will be
> disconnected from the observation facility when B is closed.  This is
> somewhat odd, because you add event listeners to a workspace-bound
> observation manager, not to a session.  However, jackrabbit
> implementation uses the observation mechanism extensively, but using
> internal "system" sessions, which, I'm guessing, are never closed.
> 
> What is the best practice that you all can recommend when you need
> long-running listeners without the overhead of keeping sessions
> opened?  Or do we follow jackrabbit example and squirrel some sessions
> away and keep them open to keep the observation events communication
> flowing?
> Please advise.
> 
> Thank you!