Return-Path: Delivered-To: apmail-incubator-jackrabbit-dev-archive@www.apache.org Received: (qmail 25416 invoked from network); 10 Dec 2005 02:30:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Dec 2005 02:30:10 -0000 Received: (qmail 44447 invoked by uid 500); 10 Dec 2005 02:30:08 -0000 Mailing-List: contact jackrabbit-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jackrabbit-dev@incubator.apache.org Delivered-To: mailing list jackrabbit-dev@incubator.apache.org Received: (qmail 44430 invoked by uid 99); 10 Dec 2005 02:30:07 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Dec 2005 18:30:07 -0800 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: 193.19.192.5 is neither permitted nor denied by domain of the.mindstorm.mailinglist@gmail.com) Received: from [193.19.192.5] (HELO mail.evolva.ro) (193.19.192.5) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Dec 2005 18:30:05 -0800 Received: (qmail 85530 invoked by uid 1013); 10 Dec 2005 02:29:41 -0000 Received: from 86.55.40.139 by mail.evolva.ro (envelope-from , uid 89) with qmail-scanner-1.25 (clamdscan: 0.87.1/1167. Clear:RC:1(86.55.40.139):. Processed in 0.394319 secs); 10 Dec 2005 02:29:41 -0000 Received: from unknown (HELO ?192.168.62.51?) (alexandru.popescu@evolva.ro@86.55.40.139) by mail.evolva.ro with AES256-SHA encrypted SMTP; 10 Dec 2005 02:29:41 -0000 Message-ID: <439A3D4D.4090203@gmail.com> Date: Sat, 10 Dec 2005 04:28:29 +0200 From: Alexandru Popescu User-Agent: Thunderbird 1.5 (Windows/20051025) MIME-Version: 1.0 To: devJackrabbit Subject: BindableRepository profiling and suggested patch Content-Type: multipart/mixed; boundary="------------090400060503050704020906" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------090400060503050704020906 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi! I've been profiling an application using Jackrabbit by means of BindableRepository. I have noticed that on consequetive redeployments a lot of memory is not freed (check the attached picture). As you can notice a lot of this space is used by java.lang.Shutdown which keeps the shutdown hooks. The application has context listeners that are correctly unregistering the BindableRepository (using RegistryHelper). My proposed patch is the following: 1/ keep the shutdown hook thread in the BindableRepository after init is called; 2/ if the BindableRepository.shutdown is correctly called by means of RegistryHelper than remove the shutdown hook Attached is also the patch generated upon BindableRepository v.307128. What is your opinion on this? ./alex -- .w( the_mindstorm )p. --------------090400060503050704020906 Content-Type: text/plain; name="BindableRepository-patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="BindableRepository-patch.txt" Index: D:/workspace/java/cvsprojects/svn/jackrabbit/jackrabbit/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java =================================================================== --- D:/workspace/java/cvsprojects/svn/jackrabbit/jackrabbit/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java (revision 350050) +++ D:/workspace/java/cvsprojects/svn/jackrabbit/jackrabbit/src/main/java/org/apache/jackrabbit/core/jndi/BindableRepository.java (working copy) @@ -82,6 +82,8 @@ /** The delegate repository instance. Created by {@link #init() init}. */ private transient Repository delegatee; + private transient Thread hook; + /** * Creates a BindableRepository instance with the given configuration * information, but does not create the underlying repository instance. @@ -122,11 +124,13 @@ RepositoryConfig config = RepositoryConfig.create(configFilePath, repHomeDir); delegatee = RepositoryImpl.create(config); - Runtime.getRuntime().addShutdownHook(new Thread() { + hook= new Thread() { public void run() { shutdown(); } - }); + }; + + Runtime.getRuntime().addShutdownHook(hook); } //-----------------------------------------------------------< Repository > @@ -247,5 +251,6 @@ */ void shutdown() { ((RepositoryImpl) delegatee).shutdown() ; + Runtime.getRuntime().removeShutdownHook(hook); } } --------------090400060503050704020906--