Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 8731 invoked from network); 7 Oct 2010 08:49:57 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Oct 2010 08:49:57 -0000 Received: (qmail 69762 invoked by uid 500); 7 Oct 2010 08:49:57 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 69667 invoked by uid 500); 7 Oct 2010 08:49:53 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 69658 invoked by uid 99); 7 Oct 2010 08:49:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Oct 2010 08:49:52 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Oct 2010 08:49:51 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o978nVRL024576 for ; Thu, 7 Oct 2010 08:49:31 GMT Message-ID: <12556749.22711286441371283.JavaMail.jira@thor> Date: Thu, 7 Oct 2010 04:49:31 -0400 (EDT) From: "Jukka Zitting (JIRA)" To: dev@jackrabbit.apache.org Subject: [jira] Commented: (JCR-2768) Finalize method on SessionImpl In-Reply-To: <6928009.562191286319513272.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/JCR-2768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12918840#action_12918840 ] Jukka Zitting commented on JCR-2768: ------------------------------------ Could we use weak references instead of phantom references? When a weak reference is queued for destruction, you can still access the referenced object. It probably still comes with similar (if not worse) garbage collection overhead as a finalizer, but perhaps clearing the reference when a normal logout() is called would avoid that. > Finalize method on SessionImpl > ------------------------------ > > Key: JCR-2768 > URL: https://issues.apache.org/jira/browse/JCR-2768 > Project: Jackrabbit Content Repository > Issue Type: Improvement > Components: jackrabbit-core > Affects Versions: 2.1.0 > Reporter: Douglas Britsch > > Doing some profiling on our application which uses Jackrabbit-2.1.0 I noticed that there were an awful lot of java.lang.ref.Finalizer objects hanging around. Digging around I found the culprit was a finalize method on SessionImpl. While I can see what it is trying to do (close the session if you have not called logout) , I have found in the past that on application servers, finalize should be avoided for objects that are created and deleted frequently, as the GC behavior and object allocation is severely impacted, and because of the number of references held by the session this seems like it could keep a lot more in memory than needed a lot longer. (for more info see http://www.fasterj.com/articles/finalizer1.shtml ). > Per Jukka's suggestion on the mailing list " > The automatic closing of a discarded session and related the warning > message are pretty useful in practice, as there are quite a few > session leaks in many client applications. So I'd rather keep that > functionality. > If the finalizer causes problems, we could investigate using weak (or > perhaps phantom) references and a reference queue for this purpose. > The RepositoryImpl class already keeps weak references to all sessions > in the activeSessions map, so this shouldn't even be too difficult to > implement." -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.