From eb12cc5d6bcbc25ea70f678321693971a0bd921c Mon Sep 17 00:00:00 2001 From: chiba Date: Fri, 4 Nov 2005 06:00:46 +0000 Subject: updated CtMember.append() for better performance. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@216 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- tutorial/tutorial.html | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'tutorial') diff --git a/tutorial/tutorial.html b/tutorial/tutorial.html index f591abe7..271e88de 100644 --- a/tutorial/tutorial.html +++ b/tutorial/tutorial.html @@ -298,7 +298,9 @@ such a method call, the ClassPool must contain all the instances of CtClass all the time of program execution. +

Avoid out of memory

+

This specification of ClassPool may cause huge memory @@ -337,13 +339,26 @@ cp.appendSystemPath(); // or append another path by appendClassPath() default ClassPool returned by ClassPool.getDefault() does. Note that ClassPool.getDefault() is a singleton factory method -provided for convenience. Therefore, the default ClassPool -is never garbage-collected. +provided for convenience. It creates a ClassPool object in +the same way shown above although it keeps a single instance of +ClassPool and reuses it. +A ClassPool object returned by getDefault() +does not have a special role. getDefault() is a convenience +method. +

Cascaded ClassPools.

-ClassPool objects can be cascaded like +If a program is running on a web application server, +creating multiple instances of ClassPool might be necessary; +an instance of ClassPool should be created +for each class loader (i.e. container). +The program should create a ClassPool object by not calling +getDefault() but a constructor of ClassPool. + +

+Multiple ClassPool objects can be cascaded like java.lang.ClassLoader. For example,