Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 5415 invoked from network); 9 Mar 2005 07:10:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 9 Mar 2005 07:10:33 -0000 Received: (qmail 48585 invoked by uid 500); 9 Mar 2005 07:10:32 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 48054 invoked by uid 500); 9 Mar 2005 07:10:31 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 48041 invoked by uid 99); 9 Mar 2005 07:10:30 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=URIBL_WS_SURBL X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from postfix4-1.free.fr (HELO postfix4-1.free.fr) (213.228.0.62) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 08 Mar 2005 23:10:29 -0800 Received: from [192.168.0.100] (lns-vlq-39f-81-56-134-235.adsl.proxad.net [81.56.134.235]) by postfix4-1.free.fr (Postfix) with ESMTP id 5F9B42B5AE8 for ; Wed, 9 Mar 2005 08:10:26 +0100 (CET) Message-ID: <422EA160.5070601@apache.org> Date: Wed, 09 Mar 2005 08:10:24 +0100 From: Sylvain Wallez Organization: Anyware Technologies User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: Experimental per-sitemap reloadable classloader References: <422E2C9E.9090608@apache.org> <422E3D12.7010505@apache.org> In-Reply-To: <422E3D12.7010505@apache.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Torsten Curdt wrote: >> A side benefit, tremedously useful, is that the classloader is >> re-created when the sitemap is reloaded. So this allows, by setting a >> class-dir, to reload changed classes simply by touching the sitemap. > > > Awesome, mate! :-D > > If we integrate the file alteration monitor from > jci we can even trigger the sitemap reload > without the need of touching the sitemap. > > ...and we could also hook in the byte code > transformations (if needed ..like for javaflow) > > Do you think that would work? The classloader is created by a factory that is looked up using o.a.c.Core.ClassLoaderFactory, given the configuration object (see in src/java/core). So by defining this component in the root cocoon.xconf, we can plug in any classloader strategy we want. What's missing however, is the notification link between the classloader and the sitemap engine, in order to trigger reloading. That's something that should be fairly easy to add. >> Maybe not as smart as an automatic compiling classloader, but as saving > > > ...not sure if it really has to be a compiling classloader > as long as we have a automated reloading from within the ide. Yep, you're right. It only has a drawback for the vi or emacs addicts ;-) >> This feature is intended for application development-time, as it >> doesn't take into consideration instances of the previous versions of >> the reloaded classes that may be stored here and there such as in >> session attributes. That means that you may get some >> ClassCastException whenever such a cases arises. This is the current >> price to pay for fast roundtrips. > > > I think that's ok for development! Overnight (the brain is a non-stop machine) I found a scheme that could avoid this session-attribute annoyance: we can automatically invalidate sessions that have been created before the classloader creation. When a local classloader is created somewhere within Cocoon, a timestamp is stored in a global Context attribute. When a request comes in, we invalidate the session (if it exists) if it was created before the last classloader creation. HttpSession.getCreationTime() gives us the necessary information for this. > Great stuff! Thanks! Not that complicated though: I added the handling of in CoreServiceManager and reused some parts of the paranoid block. A 2-hours hacking session to save a lot of time :-) Sylvain -- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }