Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 71903 invoked from network); 15 Oct 2010 10:17:52 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Oct 2010 10:17:52 -0000 Received: (qmail 56470 invoked by uid 500); 15 Oct 2010 10:17:52 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 56196 invoked by uid 500); 15 Oct 2010 10:17:49 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 56187 invoked by uid 99); 15 Oct 2010 10:17:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Oct 2010 10:17:48 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ianboston@gmail.com designates 74.125.82.50 as permitted sender) Received: from [74.125.82.50] (HELO mail-ww0-f50.google.com) (74.125.82.50) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Oct 2010 10:17:39 +0000 Received: by wwb39 with SMTP id 39so760268wwb.19 for ; Fri, 15 Oct 2010 03:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:content-type :mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=GmT2NnkNFG9uAXkcY5fAh8Xlx3sXPaJxio2v6YEjx+w=; b=bl/D50QEMHdK0PisNAObwgCmWNEARCKduBpioxFmPQSIy45AgTV2DgymyoAOdUcqkB E4cSFYAsH89txeM5MrxeQjljXMhO+TBHUSMxnEsk/AN0YOeCl2a2JIwNOIeXVlEHfoD8 kHCxuP8UTASU/hFdqgJQcHD2PhgK/EFSdjTZ0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=nJlXW6b2fA0NglBDGnFd/ji8mJfXgekCyXLmwEveV+xPWlnB+ojQPbeFKlToHnTCDs vzbDIGTX5RTmyB70Uv3FdZqqTYBphnPKE14jF+jA62oxyrwkGYOV9ja3CA3V4Eff+pks hddoji8mF+m0rCOZmp/WThZibR5AgfEWQ0N5Y= Received: by 10.227.141.146 with SMTP id m18mr698435wbu.34.1287137839369; Fri, 15 Oct 2010 03:17:19 -0700 (PDT) Received: from [192.168.1.6] (188-222-179-241.zone13.bethere.co.uk [188.222.179.241]) by mx.google.com with ESMTPS id g9sm10451891wbh.19.2010.10.15.03.17.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 15 Oct 2010 03:17:18 -0700 (PDT) Sender: Ian Boston Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1081) Subject: Re: Is an ObservationManager safe to use across threads? From: Ian Boston In-Reply-To: Date: Fri, 15 Oct 2010 11:17:16 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: users@jackrabbit.apache.org X-Mailer: Apple Mail (2.1081) X-Virus-Checked: Checked by ClamAV on apache.org On 15 Oct 2010, at 10:46, Vidar Ramdal wrote: > Is this safe, or is the ObservationManager retrieved by > session.getWorkspace().getObservationManager() tied to the session > from which it was acquired? In general its not safe since the session the observation manager was = created with (which must stay logged in for the ObservationManager to = remain active) is stored internally and used internally. There is one = point where a check is made to ensure the same session is connected to = dispatches, however, in the case of removeEventListener although some new objects = are created that are bound to the original session those objects are = only used as keys to facilitate removal of the listener so you should be = Ok. BTW, Using a session inside an event listener will almost certainly lead to = massive blocking and potentially even deadlocks as the lower levels are = protected (post 1.4 IIRC) to allow sessions to be shared between = multiple threads without doing permanent damage, so think of the onEvent = and the class/session that bound the on event as completely separate = (and unfriendly) threads that will conflict. ie, be very careful what = you share inside and outside the onEvent method. HTH Ian=