Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 34560 invoked from network); 31 Aug 2006 17:20:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 31 Aug 2006 17:20:28 -0000 Received: (qmail 90637 invoked by uid 500); 31 Aug 2006 17:20:21 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 90605 invoked by uid 500); 31 Aug 2006 17:20:20 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 90583 invoked by uid 99); 31 Aug 2006 17:20:20 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Aug 2006 10:20:20 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [203.59.1.224] (HELO mail-ihug.icp-qv1-irony6.iinet.net.au) (203.59.1.224) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Aug 2006 10:20:19 -0700 Received: from 203-173-47-49.dyn.iinet.net.au (HELO julia) ([203.173.47.49]) by mail-ihug.icp-qv1-irony6.iinet.net.au with ESMTP; 01 Sep 2006 01:19:56 +0800 X-BrightmailFiltered: true X-Brightmail-Tracker: AAAAAA== X-IronPort-AV: i="4.08,195,1154880000"; d="scan'208"; a="437087405:sNHT15192252" From: "Stephen McConnell" To: "'Ant Users List'" Subject: RE: Jar Locking Date: Fri, 1 Sep 2006 02:49:52 +0930 Keywords: Business Message-ID: <006a01c6cd21$ac0dd3c0$0301a8c0@julia> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcbNH8F1QVGKLrRnRomn7ntIzEifxgAAKtNw X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 In-Reply-To: <372d719d0608311004t22bab121u946d0c8fe791c01b@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N > -----Original Message----- > From: Marc Farrow [mailto:marc.farrow@gmail.com] > Sent: Friday, 1 September 2006 2:35 AM > To: Ant Users List > Subject: Re: Jar Locking > > Thanks Stephen. If I set all references to Ant to null and > forced GC, would that resolve the problem? Well, umm, this is tricky. If your loading a task or data type definition I think Ant holds a strong reference to the class which would suggest that setting things to null would not change (because strong references are held for the life of the JVM). I may be wrong here because it's been a while since I dug into Ant internals on task class references - but one of the Ant Developers could probably confirm things. However, if your running Ant as an embedded solution - then in principal the disposal of the Ant project would clear any task and datatype references and you may have a chance. But this is tricky stuff and getting it right really requires that the Ant project and all Ant related stuff is loaded in a child classloader relative to the launching application (i.e. it's the classloader disposal that is key to the releasing of the file reference). It is possible - but it's not trivial. Cheers, Steve. > > On 8/31/06, Stephen McConnell wrote: > > > > > > > > > -----Original Message----- > > > From: Marc Farrow [mailto:marc.farrow@gmail.com] > > > Sent: Thursday, 31 August 2006 6:13 AM > > > To: ant-user > > > Subject: Jar Locking > > > > > > Everytime I run an ant task (either in NetBeans or from > within Java > > > Code), the executing jar gets locked and I cannot delete > the jar. I > > > am copying the ant script and the dependent jar that it > needs to run > > > and then executing the ant tasks. Then I wish to delete > the "new" > > > copy I just created to run, but a jar I am using is > locked and will > > > not allow me. > > > This in on a Windows 2000 machine. > > > > The jar file is locked because it is referenced in a > classloader. The > > lock will be released once the classloader is garbage collected but > > that will not happen until all references to all classes defined by > > the jar are no longer referenced. If the jar file in question is > > referenced by Ant then chances are that your file will not > be released > > until the Ant Project instance is no longer in use. > > > > The solution to the problem is to handle the creation and updating > > operations under two distinct projects. One project handles the > > creation of a new jar file, and the second project handles the > > replication of the jar (with the assumption that your > second project > > does not include a classpath reference to the jar file). > > > > Cheers, Steve. > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For > additional > > commands, e-mail: user-help@ant.apache.org > > > > > > > -- > Marc Farrow > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org