Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 197B3BD10 for ; Tue, 10 Jan 2012 21:04:09 +0000 (UTC) Received: (qmail 12074 invoked by uid 500); 10 Jan 2012 21:04:08 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 12052 invoked by uid 500); 10 Jan 2012 21:04:07 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 12043 invoked by uid 99); 10 Jan 2012 21:04:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jan 2012 21:04:07 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [76.96.62.56] (HELO qmta06.westchester.pa.mail.comcast.net) (76.96.62.56) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jan 2012 21:03:57 +0000 Received: from omta18.westchester.pa.mail.comcast.net ([76.96.62.90]) by qmta06.westchester.pa.mail.comcast.net with comcast id Ks2c1i0091wpRvQ56x3bMZ; Tue, 10 Jan 2012 21:03:35 +0000 Received: from Christophers-MacBook-Pro.local ([69.143.109.145]) by omta18.westchester.pa.mail.comcast.net with comcast id Kx3a1i01u38FjT13ex3bWf; Tue, 10 Jan 2012 21:03:35 +0000 Message-ID: <4F0CA7A3.5070000@christopherschultz.net> Date: Tue, 10 Jan 2012 16:03:31 -0500 From: Christopher Schultz User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: Tomcat Developers List Subject: Re: More Caching for WebappClassLoader? References: <4F0C166B.3010806@kippdata.de> In-Reply-To: <4F0C166B.3010806@kippdata.de> X-Enigmail-Version: 1.3.4 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig90F195956E25726CB8DE38F7" X-Virus-Checked: Checked by ClamAV on apache.org --------------enig90F195956E25726CB8DE38F7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Rainer, On 1/10/12 5:43 AM, Rainer Jung wrote: > Now loadClass() in the WebappClasLoader does: >=20 > - check own class cache > - check super class cache > - try loading from system loader > - call Class.forName with parent loader (which calls loadClass() there)= > [only if "delegated", which is *not* the default] > - try loading via findClass() > - call Class.forName with parent loader (which calls loadClass() there)= > [only if not "delegated", which *is* the default] Hmm. > What we could do to keep the design simple is caching any positive > result from loadClass() in the WebappLoader, even it it was found via > super, system or parent. In addition we could also cache negative > results for all those. The biggest downsides I can see would be >=20 > - less dynamics: if someone had a more dynamic loader unerneath ours, > which would change the result of loadClass() during runtime, we would > shield the app from it, because we now return classes from our cache. -0? Their CL should have the opportunity to load the class first, so it doesn't matter whether or not we cache the result, right? > - increased memory use for the cache, i.e. the list of class names and > references to the classes. -1 The class names (String) and Class objects will already be in memory because they will be stored by the "real" ClassLoader that loaded them. The only thing we will have to do is pay for the additional storage of those references in our own cache -- so, it's just the cost of the additional space from our own class mapping table. > To stay completely compatible I think the feature should not be default= , > at least until TC 7, maybe switch default for 8. This could be implemented as a separate WebappClassLoader, and configured in the . That way users can choose, and the default is the old behavior. > What do you think? Does it make sense? Should I prepare a patch for tru= nk? +1 -chris --------------enig90F195956E25726CB8DE38F7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk8Mp6UACgkQ9CaO5/Lv0PBDeACgg1l4hZDZFKHQISfjBXNetOpi Q5YAn2t//W9OvPO9rJSVdahNJsoSjnNn =vken -----END PGP SIGNATURE----- --------------enig90F195956E25726CB8DE38F7--