Author: costin
Date: Tue May 23 19:53:22 2006
New Revision: 409043
URL: http://svn.apache.org/viewvc?rev=409043&view=rev
Log:
More cleanup.
Removed:
tomcat/sandbox/java/org/apache/tomcat/util/loader/Loader.java
tomcat/sandbox/java/org/apache/tomcat/util/loader/ModuleListener.java
Modified:
tomcat/sandbox/build.xml
tomcat/sandbox/java/org/apache/tomcat/util/loader/Module.java
tomcat/sandbox/java/org/apache/tomcat/util/loader/ModuleClassLoader.java
tomcat/sandbox/java/org/apache/tomcat/util/loader/Repository.java
tomcat/sandbox/java/org/apache/tomcat/util/loader/RepositoryClassLoader.java
tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java
Modified: tomcat/sandbox/build.xml
URL:
http://svn.apache.org/viewvc/tomcat/sandbox/build.xml?rev=409043&r1=409042&r2=409043&view=diff
==============================================================================
--- tomcat/sandbox/build.xml (original)
+++ tomcat/sandbox/build.xml Tue May 23 19:53:22 2006
@@ -8,19 +8,16 @@
<property file="../build/build.properties"/>
<property file="../build/build.properties.default"/>
- <property name="tc55xbase" location=".." />
+ <property name="tc.base" location=".." />
<!-- Source dependencies -->
<property name="target.vm" value="1.5"/>
<property name="source.vm" value="1.5"/>
- <property name="api.home" value="${tc55xbase}/servletapi"/>
- <property name="container.home" value="${tc55xbase}/container"/>
- <property name="jasper.home" value="${tc55xbase}/jasper"/>
- <property name="jtc.home" value="${tc55xbase}/connectors"/>
- <property name="connectors.home" value="${tc55xbase}/connectors"/>
- <property name="sandbox.home" value="${tc55xbase}/sandbox"/>
- <property name="tomcat.home" value="${tc55xbase}/build"/>
- <property name="build.home" value="${tc55xbase}/build"/>
+
+ <property name="tc6.home" value="${tc.base}/tomcat6"/>
+ <property name="sandbox.home" value="${tc.base}/sandbox"/>
+ <property name="tomcat.home" value="${tc.base}/tomcat6/build"/>
+ <property name="build.home" value="${tc.base}/build"/>
<property name="ant.jar" value="${ant.home}/lib/ant.jar"/>
<property name="ant-launcher.jar"
value="${ant.home}/lib/ant-launcher.jar"/>
@@ -29,7 +26,6 @@
<property name="catalina.build" value="${container.home}/build"/>
<property name="jasper.build" value="${jasper.home}/build"/>
<property name="tomcat.build" value="${basedir}/build"/>
- <property name="build.home" value="${tomcat.build}"/>
<property name="tomcat-dbcp.home" value="${base.path}/tomcat-deps" />
<property name="tomcat-dbcp.jar"
value="${tomcat-dbcp.home}/naming-factory-dbcp.jar"/>
@@ -43,23 +39,12 @@
<property name="compile.deprecation" value="false" />
<property name="compile.source" value="1.5" />
+ <property name="tc6.classes" location="${tc6.home}/.settings/output"/>
-
- <!-- ======================= Single-jar minimal tomcat =========== -->
+ <!-- ======================= Single-jar minimal tomcat =========== -->
<path id="runtime-deps" >
- <pathelement
location="${base.path}/commons-modeler-1.1/commons-modeler.jar"/>
- <pathelement location="${base.path}/servlet-api-2.4/lib/servlet-api.jar"/>
- <pathelement location="${base.path}/jsp-api-2.0/lib/jsp-api.jar"/>
- <pathelement location="${base.path}/mx4j-3.0.1/lib/mx4j.jar"/>
- <pathelement location="${base.path}/commons-el-1.0/commons-el.jar" />
<pathelement location="${base.path}/tomcat-deps/jasper-compiler-jdt.jar" />
- <pathelement
location="${base.path}/commons-logging-1.0.4/commons-logging-api.jar" />
- <pathelement
location="${base.path}/commons-collections-3.1/commons-collections-3.1.jar" />
- <pathelement location="${base.path}/apache-ant-1.6.5/lib/ant.jar"/>
- <pathelement
location="${base.path}/commons-launcher-0.9/bin/commons-launcher.jar"/>
- <pathelement location="${base.path}/struts-1.2.7/lib/struts.jar"/>
- <pathelement location="${base.path}/rhino1_6R2/js.jar"/>
</path>
<patternset id="runtime-all-excludes">
@@ -94,61 +79,18 @@
<exclude name="org/apache/catalina/core/NamingContextListener.java"/>
<patternset refid="runtime-all-excludes"/>
</patternset>
-
- <path id="runtime-src-path">
- <pathelement path="${connectors.home}/util/java"/>
- <pathelement path="${connectors.home}/util/loader"/>
- <pathelement path="${connectors.home}/jni/java"/>
- <pathelement path="${connectors.home}/coyote/src/java"/>
- <pathelement path="${connectors.home}/http11/src/java"/>
- <pathelement path="${container.home}/catalina/src/share"/>
- <pathelement path="${connectors.home}/juli/src"/>
- </path>
- <path id="runtime-all-src-path">
- <path refid="runtime-src-path"/>
- <pathelement path="${jasper.home}/src/share"/>
- </path>
- <!-- =================== Eclipse/Idea equivalent ================== -->
- <!-- If you are in an IDE environment, it should reuse the result of
- the (re)compilation - so ant will only do packaging -->
- <target name="compile-connectors">
- <mkdir dir="${connectors.home}/bin" />
- <javac destdir="${connectors.home}/bin" source="${source.vm}"
target="${target.vm}"
- deprecation="false" debug="false" >
- <classpath refid="runtime-deps" />
- <src path="${connectors.home}/coyote/src/java" />
- <src path="${connectors.home}/http11/src/java" />
- <src path="${connectors.home}/jni/java" />
- <src path="${connectors.home}/jni/examples" />
- <src path="${connectors.home}/juli/src/java" />
- <src path="${connectors.home}/util/java" />
- <src path="${connectors.home}/util/loader" />
- <exclude name="org/apache/coyote/tomcat3/**"/>
- <exclude name="org/apache/coyote/tomcat4/**"/>
- <exclude name="org/apache/tomcat/util/net/puretls/**"/>
- <exclude
name="org/apache/tomcat/util/net/jsse/JSSE15SocketFactory.java"/>
- </javac>
- <copy todir="${connectors.home}/bin" >
- <fileset dir="${connectors.home}/util/java" includes="**/*.properties
**/*.xml"/>
- <fileset dir="${connectors.home}/naming/src" includes="**/*.properties
**/*.xml"/>
- <fileset dir="${connectors.home}/coyote/src/java"
includes="**/*.properties **/*.xml" >
- <exclude name="org/apache/coyote/tomcat4/**"/>
- </fileset>
- <fileset dir="${connectors.home}/http11/src/java"
includes="**/*.properties **/*.xml"/>
- </copy>
- </target>
-
<target name="compile-sandbox">
<mkdir dir="${sandbox.home}/classes" />
- <javac destdir="${sandbox.home}/classes" source="${source.vm}"
target="${target.vm}"
- deprecation="false" debug="false" >
+ <javac destdir="${sandbox.home}/classes" source="${source.vm}"
+ target="${target.vm}"
+ deprecation="false"
+ debug="false" >
<src path="${sandbox.home}/java" />
<classpath>
<path refid="runtime-deps" />
- <pathelement location="${connectors.home}/bin"/>
- <pathelement location="${container.home}/bin"/>
+ <pathelement location="${tc6.classes}"/>
</classpath>
</javac>
<copy todir="${sandbox.home}/classes" >
@@ -156,77 +98,42 @@
</copy>
</target>
- <target name="compile-container">
- <mkdir dir="${container.home}/bin" />
- <javac destdir="${container.home}/bin" source="${source.vm}"
target="${target.vm}"
- deprecation="false" debug="false" >
- <src path="${container.home}/catalina/src/share" />
- <!--
- <src path="${container.home}/modules/cluster/src/share" />
- <src path="${container.home}/modules/storeconfig/src/share" />
- <src path="${container.home}/webapps/admin/WEB-INF/classes" />
- <src path="${container.home}/webapps/balancer/WEB-INF/classes" />
- <src path="${container.home}/webapps/host-manager/WEB-INF/classes" />
- <src path="${container.home}/webapps/manager/WEB-INF/classes" />
- -->
- <src path="${container.home}/webapps/jmxremote/WEB-INF/src" />
- <src path="${container.home}/webapps/docs/appdev/sample/src" />
+ <target name="compile-tc6">
+ <mkdir dir="${tc6.classes}" />
+ <javac destdir="${tc6.classes}"
+ source="${source.vm}"
+ target="${target.vm}"
+ deprecation="false"
+ debug="false" >
+ <src path="${tc6.home}/java" />
<classpath>
<path refid="runtime-deps" />
- <pathelement location="${connectors.home}/bin"/>
</classpath>
- <exclude name="**/MailSessionFactory.java"/>
- <exclude name="**/SendMailFactory.java"/>
</javac>
- <copy todir="${container.home}/bin" >
- <fileset dir="${container.home}/catalina/src/share"
includes="**/*.properties **/*.xml"/>
+ <copy todir="${tc6.classes}" >
+ <fileset dir="${tc6.home}/java" includes="**/*.properties **/*.xml"/>
</copy>
</target>
- <target name="compile-jasper">
- <mkdir dir="${jasper.home}/bin" />
- <javac destdir="${jasper.home}/bin" source="${source.vm}"
target="${target.vm}"
- deprecation="false" debug="false" >
- <src path="${jasper.home}/src/share" />
- <classpath>
- <path refid="runtime-deps" />
- <pathelement location="${connectors.home}/bin"/>
- </classpath>
- </javac>
- </target>
-
<target name="compile"
-
depends="compile-connectors,compile-container,compile-sandbox,compile-jasper"/>
+ depends="compile-sandbox,compile-tc6"/>
<target name="clean-compile">
- <delete dir="${container.home}/bin" includes="**"/>
<delete dir="${sandbox.home}/classes" includes="**"/>
- <delete dir="${connectors.home}/bin" includes="**"/>
- <delete dir="${jasper.home}/bin" includes="**"/>
+ <delete dir="${tc6.classes}" includes="**"/>
</target>
-
<target name="tomcat-runtime.jar"
description="Build single jar tomcat"
depends="compile,pack_tomcat-runtime.jar">
</target>
-
<target name="pack_tomcat-runtime.jar"
description="Pack single jar tomcat" >
<mkdir dir="runtime" />
- <jar jarfile="runtime/tomcat-runtime.jar" manifest="resources/runtime.MF">
- <fileset dir="${container.home}/bin" >
+ <jar jarfile="runtime/tomcat-runtime.jar"
+ manifest="resources/runtime.MF">
+ <fileset dir="${tc6.classes}" >
<exclude name="org/apache/tomcat/util/buf/**"/>
- </fileset>
- <fileset dir="${sandbox.home}/classes" >
- <exclude name="org/apache/tomcat/util/net/Leader**"/>
- <exclude name="org/apache/tomcat/util/net/Master**"/>
- <exclude name="org/apache/tomcat/util/net/SSL**"/>
- <exclude name="org/apache/tomcat/util/net/jsse/**"/>
- <exclude name="org/apache/tomcat/util/net/ServerSocketFactory**"/>
- <exclude name="org/apache/tomcat/util/net/Default**"/>
- </fileset>
- <fileset dir="${connectors.home}/bin" >
<exclude name="org/apache/coyote/http11/*"/>
<exclude name="org/apache/tomcat/util/buf/**"/>
<exclude name="org/apache/tomcat/util/net/jsse/**"/>
@@ -237,93 +144,9 @@
<exclude name="org/apache/tomcat/util/threads/Control**"/>
<exclude name="org/apache/tomcat/util/threads/Monitor**"/>
<exclude name="org/apache/tomcat/util/net/**"/>
+ <exclude name="org/apache/jasper/**"/>
</fileset>
- <zipfileset src="${base.path}/servlet-api-2.4/lib/servlet-api.jar" >
- <exclude name="META-INF/**" />
- <exclude name="**/*.html" />
- </zipfileset>
- <zipfileset src="${base.path}/commons-modeler-1.1/commons-modeler.jar">
- <exclude name="org/apache/commons/modeler/ant/**" />
- <exclude name="org/apache/catalina/ant/**" />
- <exclude name="META-INF/**" />
- <exclude name="**/*.html" />
- </zipfileset>
- <zipfileset src="${base.path}/jsp-api-2.0/lib/jsp-api.jar">
- <exclude name="META-INF/**" />
- <exclude name="**/*.html" />
- </zipfileset>
- </jar>
-
- </target>
-
-
- <!-- Larger tomcat runtime, with jasper and some other packages.
- JK could be excluded - this is not intended for full servers, just apps.
- -->
- <target name="runtime-all"
- description="Build single jar tomcat - all inclusive" depends="compile">
- <mkdir dir="runtime" />
- <jar jarfile="runtime/tomcat-all-runtime.jar"
manifest="resources/runtime.MF">
- <fileset dir="${container.home}/bin" >
- <exclude name="org/apache/tomcat/util/buf/**"/>
- </fileset>
- <fileset dir="${sandbox.home}/bin" >
- </fileset>
- <fileset dir="${jasper.home}/bin" >
- </fileset>
- <fileset dir="${connectors.home}/bin" >
- <exclude name="org/apache/tomcat/util/buf/**"/>
- </fileset>
- <zipfileset src="${base.path}/servlet-api-2.4/lib/servlet-api.jar" >
- <exclude name="META-INF/**" />
- <exclude name="**/*.html" />
- </zipfileset>
- <zipfileset src="${base.path}/commons-modeler-1.1/commons-modeler.jar">
- <exclude name="org/apache/commons/modeler/ant/**" />
- <exclude name="org/apache/catalina/ant/**" />
- <exclude name="META-INF/**" />
- <exclude name="**/*.html" />
- </zipfileset>
- <zipfileset src="${base.path}/jsp-api-2.0/lib/jsp-api.jar">
- <exclude name="META-INF/**" />
- <exclude name="**/*.html" />
- </zipfileset>
-
- <zipfileset src="${base.path}/tomcat-deps/jasper-compiler-jdt.jar" >
- <exclude name="META-INF/**" />
- <exclude name="**/*.html" />
- </zipfileset>
- <zipfileset src="${base.path}/commons-el-1.0/commons-el.jar" >
- <exclude name="META-INF/**" />
- <exclude name="**/*.html" />
- </zipfileset>
- <zipfileset src="${base.path}/jsp-api-2.0/lib/jsp-api.jar">
- <exclude name="META-INF/**" />
- <exclude name="**/*.html" />
- </zipfileset>
- </jar>
-
- </target>
-
- <!-- ======================= Coyote standalone =========== -->
- <!--
- This is only the http connector, for testing/experimental purposes.
- -->
-
- <target name="tomcat-http11"
- depends="compile-connectors,compile-sandbox,tomcat-http11.jar">
- </target>
-
- <target name="tomcat-http11.jar">
- <mkdir dir="runtime"/>
- <jar jarfile="runtime/tomcat-http11.jar"
manifest="resources/coyote-http11.MF">
<fileset dir="${sandbox.home}/classes" >
- <include name="org/**" />
- <exclude name="org/apache/coyote/http11/Http11Protocol**"/>
- <exclude name="org/apache/coyote/http11/Http11AprProcessor**"/>
- <exclude name="org/apache/coyote/http11/Http11AprProtocol**"/>
- <exclude name="org/apache/coyote/http11/InternalAprInputBuffer**"/>
- <exclude name="org/apache/coyote/http11/InternalAprOutputBuffer**"/>
<exclude name="org/apache/tomcat/util/net/Leader**"/>
<exclude name="org/apache/tomcat/util/net/Master**"/>
<exclude name="org/apache/tomcat/util/net/SSL**"/>
@@ -331,44 +154,47 @@
<exclude name="org/apache/tomcat/util/net/ServerSocketFactory**"/>
<exclude name="org/apache/tomcat/util/net/Default**"/>
</fileset>
+ </jar>
- <fileset dir="${connectors.home}/bin" >
- <include name="org/apache/tomcat/util/**"/>
- <include name="org/apache/tomcat/jni/**"/>
- <include name="org/apache/tomcat/*"/>
- <include name="org/apache/coyote/**"/>
- <exclude name="org/apache/coyote/memory/**"/>
- <exclude name="org/apache/coyote/http11/*"/>
- <include name="org/apache/coyote/http11/filters/*"/>
- <exclude name="org/apache/tomcat/util/buf/**"/>
- <exclude name="org/apache/tomcat/util/IntrospectionUtils**"/>
- <exclude name="org/apache/tomcat/util/digester/**"/>
- <exclude name="org/apache/tomcat/util/compat/**"/>
- <exclude name="org/apache/tomcat/util/jmx/**"/>
- <exclude name="org/apache/tomcat/util/net/**"/>
- <exclude name="org/apache/tomcat/util/log/**"/>
- <exclude name="org/apache/tomcat/util/threads/Expirer**"/>
- <exclude name="org/apache/tomcat/util/threads/Reaper**"/>
- <exclude name="org/apache/tomcat/util/threads/ThreadPoolListener.*"/>
- <exclude name="org/apache/tomcat/util/threads/ThreadPool.*"/>
- <exclude name="org/apache/tomcat/util/threads/Control**"/>
- <exclude name="org/apache/tomcat/util/threads/Monitor**"/>
- </fileset>
+ </target>
+ <target name="coyote-servlet.jar" depends="compile,pack_coyote-servlet.jar"/>
+
+ <target name="pack_coyote-servlet.jar" >
+ <jar destfile="runtime/coyote-servlet.jar"
manifest="resources/coyote-servlet.MF">
+ <fileset dir="classes" >
+ <include name="org/apache/commons/**"/>
+ <include name="org/apache/coyote/servlet/**"/>
+ <include name="org/apache/tomcat/util/buf/**"/>
+ <include name="org/apache/tomcat/util/loader/**"/>
+ <include name="org/apache/tomcat/util/log/**"/>
+ <include name="org/apache/tomcat/util/net/**"/>
+ <include name="org/apache/tomcat/util/threads/**"/>
+ <include name="org/apache/tomcat/servlets/file/**"/>
+ </fileset>
+ <fileset dir="${tc6.classes}" >
+ <include name="javax/servlet/*"/>
+ <include name="javax/servlet/http/*"/>
+ <include name="org/apache/coyote/*"/>
+ <include name="org/apache/coyote/http11/Constants**"/>
+ <include name="org/apache/coyote/http11/*Filter.class"/>
+ <include name="org/apache/coyote/http11/LocalStrings.properties"/>
+ <include name="org/apache/coyote/http11/filters/**"/>
+ <include name="org/apache/tomcat/util/collections/*"/>
+ <include name="org/apache/tomcat/util/net/URL*"/>
+ <include name="org/apache/tomcat/util/http/**"/>
+ <include name="org/apache/tomcat/util/res/**"/>
+ <include name="org/apache/tomcat/util/*"/>
+ </fileset>
</jar>
</target>
- <target name="all" depends="tomcat-http11,tomcat-runtime.jar,runtime-all" />
+ <target name="all" depends="coyote-servlet.jar,tomcat-runtime.jar" />
<!-- ============ Download targets for deps ================ -->
<target name="download" >
- <antcall target="downloadzip">
- <param name="sourcefile" value="${rhino.loc}"/>
- <param name="destfile" value="${rhino.jar}"/>
- <param name="destdir" value="${base.path}"/>
- </antcall>
</target>
<target name="testexist">
Modified: tomcat/sandbox/java/org/apache/tomcat/util/loader/Module.java
URL:
http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/loader/Module.java?rev=409043&r1=409042&r2=409043&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/tomcat/util/loader/Module.java (original)
+++ tomcat/sandbox/java/org/apache/tomcat/util/loader/Module.java Tue May 23
19:53:22 2006
@@ -61,7 +61,7 @@
*/
private boolean delegate = false;
- private Class classLoaderClass;
+ //private Class classLoaderClass;
/**
* The Java class name of the ClassLoader implementation to be used.
@@ -84,7 +84,7 @@
/**
* The set of repositories associated with this class loader.
*/
- private String repositories[] = new String[0];
+ //private String repositories[] = new String[0];
private URL classpath[] ;
private File workDir;
@@ -102,7 +102,7 @@
/**
* Return the Java class loader to be used by this Container.
*/
- public ClassLoader getClassLoader() {
+ ClassLoader getClassLoader() {
return classLoader;
}
@@ -134,16 +134,18 @@
/**
* Has the internal repository associated with this Loader been modified,
* such that the loaded classes should be reloaded?
+ *
+ * For normal use - call repository.isModified()
*/
public boolean modified() {
return (classLoader.modified());
}
- public boolean isStarted() {
+ boolean isStarted() {
return started;
}
- public String getClasspathString() {
+ String getClasspathString() {
if(classpath==null ) {
return null;
}
@@ -157,14 +159,15 @@
/**
* Start this component, initializing our associated class loader.
+ * Will be called by repository under normal operation - use only
+ * if you want to fine tune.
*
* @exception LifecycleException if a lifecycle error occurs
*/
public void start() {
// Validate and update our current component state
if (started)
- throw new RuntimeException
- ("Already started");
+ return;
started = true;
log("start()");
@@ -177,13 +180,13 @@
//classLoader.setResources(container.getResources());
classLoader.setDelegate(this.delegate);
- for (int i = 0; i < repositories.length; i++) {
- classLoader.addRepository(repositories[i]);
- }
+// for (int i = 0; i < repositories.length; i++) {
+// classLoader.addRepository(repositories[i]);
+// }
classLoader.start();
- getRepository().getLoader().notifyModuleStart(this);
+ //getRepository().getLoader().notifyModuleStart(this);
} catch (Throwable t) {
log( "LifecycleException ", t );
@@ -205,7 +208,7 @@
//if (DEBUG)
log("stop()", null);
- getRepository().getLoader().notifyModuleStop(this);
+ //getRepository().getLoader().notifyModuleStop(this);
started = false;
@@ -231,16 +234,17 @@
//}
- /** Set the class used to construct the class loader.
- *
- * The alternative is to set the context class loader to allow loaderClass
- * to be created.
- *
- * @param c
- */
- public void setClassLoaderClass( Class c ) {
- classLoaderClass=c;
- }
+// /** Set the class used to construct the class loader.
+// *
+// * The alternative is to set the context class loader to allow
loaderClass
+// * to be created.
+// *
+// * @param c
+// */
+// public void setClassLoaderClass( Class c ) {
+// classLoaderClass=c;
+// }
+//
/**
* Create associated classLoader.
@@ -250,9 +254,9 @@
{
if( classLoader != null ) return classLoader;
- if( classLoaderClass==null && loaderClass!=null) {
- classLoaderClass = Class.forName(loaderClass);
- }
+// if( classLoaderClass==null && loaderClass!=null) {
+// classLoaderClass = Class.forName(loaderClass);
+// }
ModuleClassLoader classLoader = null;
@@ -265,15 +269,18 @@
parentClassLoader = Thread.currentThread().getContextClassLoader();
}
- if( classLoaderClass != null ) {
- Class[] argTypes = { URL[].class, ClassLoader.class };
- Object[] args = { classpath, parentClassLoader };
- Constructor constr = classLoaderClass.getConstructor(argTypes);
- classLoader = (ModuleClassLoader) constr.newInstance(args);
- } else {
- classLoader=new ModuleClassLoader( classpath, parentClassLoader);
- }
- System.err.println("---- Created class loader " + classpath + " " +
parentClassLoader + " repo=" + repository.getName() + " " + parent);
+// if( classLoaderClass != null ) {
+// Class[] argTypes = { URL[].class, ClassLoader.class };
+// Object[] args = { classpath, parentClassLoader };
+// Constructor constr = classLoaderClass.getConstructor(argTypes);
+// classLoader = (ModuleClassLoader) constr.newInstance(args);
+// } else {
+ classLoader=new ModuleClassLoader( classpath, parentClassLoader);
+// }
+ if(DEBUG)
+ System.err.println("---- Created class loader " + classpath + " " +
+ parentClassLoader + " repo=" + repository.getName() + " " +
+ parent);
classLoader.setModule(this);
classLoader.setDelegate( delegate );
@@ -303,15 +310,18 @@
* In normal use, each module will be associated with one jar or
* classpath dir.
*
- * @param name
+ * @param name - full url
*/
public void setPath(String name) {
this.classpath=new URL[1];
try {
classpath[0]=new URL(name);
} catch (MalformedURLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ try {
+ classpath[0]=new File(name).toURL();
+ } catch (MalformedURLException e1) {
+ e1.printStackTrace();
+ }
}
}
Modified:
tomcat/sandbox/java/org/apache/tomcat/util/loader/ModuleClassLoader.java
URL:
http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/loader/ModuleClassLoader.java?rev=409043&r1=409042&r2=409043&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/tomcat/util/loader/ModuleClassLoader.java
(original)
+++ tomcat/sandbox/java/org/apache/tomcat/util/loader/ModuleClassLoader.java
Tue May 23 19:53:22 2006
@@ -23,7 +23,8 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Enumeration;
-import java.util.Vector;
+
+import org.apache.catalina.LifecycleException;
/*
* Initially, I started with WebappClassLoader attempting to clean up and
@@ -62,14 +63,13 @@
* @author Remy Maucherat
* @author Craig R. McClanahan
*/
-public class ModuleClassLoader
- extends URLClassLoader
+class ModuleClassLoader extends URLClassLoader
{
// Don't use commons logging or configs to debug loading - logging is
dependent
// on loaders and drags a lot of stuff in the classpath
//
- private static final boolean DEBUG=false;
//LoaderProperties.getProperty("loader.debug.ModuleClassLoader") != null;
- private static final boolean
DEBUGNF=false;//LoaderProperties.getProperty("loader.debug.ModuleClassLoaderNF")
!= null;
+ private static final boolean DEBUG=false;
+ private static final boolean DEBUGNF=false;
// ----------------------------------------------------------- Constructors
Modified: tomcat/sandbox/java/org/apache/tomcat/util/loader/Repository.java
URL:
http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/loader/Repository.java?rev=409043&r1=409042&r2=409043&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/tomcat/util/loader/Repository.java (original)
+++ tomcat/sandbox/java/org/apache/tomcat/util/loader/Repository.java Tue May
23 19:53:22 2006
@@ -19,9 +19,11 @@
import java.io.BufferedReader;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -29,33 +31,39 @@
/**
- * A group of modules and libraries.
+ * A group of modules.
*
- * Modules can have one or more jars and class dirs. Classloaders are created
- * from modules when the module is started are be disposed when the module is
stopped.
+ * Modules can have one or more jars and classes dirs, and are reloaded as a
+ * unit. Each module has an internal class loader.
*
* The module will delegate to the associated repository in addition to the
* normal delegation rules. The repository will search on all sibling modules.
- * This mechanism is defined in the MLetClassLoader and is also used by JBoss
and
- * few other servers.
*
- * TODO: explain more ( or point to the right jboss/mlet pages )
- * TODO: explain how this can be used for webapps to support better
partitioning
- *
+ * This mechanism is defined in the MLetClassLoader and is also used by JBoss
+ * and few other servers.
+ *
+ * Use:
+ * - create a Repository in all situations where you would need a separate
+ * class loader - each webapp, common/, server/, etc.
+ * - set the parent hierarchy
+ * - add modules to each repo - a module can be a single jar/classes, or
+ * multiple jars. I think single jar modules may be better.
+ * - get the classloader from repository
+ *
* @author Costin Manolache
*/
public class Repository {
- private static final boolean
DEBUG=Loader.getProperty("loader.debug.Repository") != null;
+ private static final boolean
DEBUG=System.getProperty("loader.debug.Repository") != null;
// Allows the (experimental) use of jar indexes
// Right now ( for small set of jars, incomplete build ) it's a tiny 3.5
-> 3.4 sec dif.
- private static final boolean
USE_IDX=Loader.getProperty("loader.Repository.noIndex") == null;
+ private static final boolean
USE_IDX=System.getProperty("loader.Repository.noIndex") == null;
private Vector loaders=new Vector();
private String name;
private Vector grpModules=new Vector();
- private transient Loader loader;
+ //private transient Loader loader;
private transient RepositoryClassLoader groupClassLoader;
private Hashtable prefixes=new Hashtable();
@@ -65,25 +73,25 @@
private Repository parent;
- private Repository() {
+ public Repository() {
}
- public Repository(Loader loader) {
- if( loader== null ) throw new NullPointerException();
- this.loader=loader;
- }
+// public Repository(Loader loader) {
+// if( loader== null ) throw new NullPointerException();
+// this.loader=loader;
+// }
- public Loader getLoader() {
- return loader;
- }
+// public Loader getLoader() {
+// return loader;
+// }
- void addModule( Module mod ) {
+ public void addModule( Module mod ) {
mod.setRepository( this );
grpModules.addElement(mod);
- if( loader.listener!=null ) {
- loader.listener.moduleAdd(mod);
- }
+// if( loader.listener!=null ) {
+// loader.listener.moduleAdd(mod);
+// }
if( parentClassLoader != null )
mod.setParentClassLoader( parentClassLoader );
@@ -167,7 +175,7 @@
return "Repository " + name + "(" + getClasspathString() + ")";
}
- private String getClasspathString() {
+ public String getClasspathString() {
StringBuffer sb=new StringBuffer();
Enumeration mE=grpModules.elements();
while( mE.hasMoreElements() ) {
@@ -250,6 +258,42 @@
if( DEBUG ) log("---------- Created repository loader " + pcl );
}
return groupClassLoader;
+ }
+
+ public void addDir(File directory) {
+ try {
+ URL url=directory.toURL();
+ Module mod = new Module();
+ mod.setClasspath(new URL[] {url});
+ addModule(mod);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ public void addLibs(File directory) {
+ if (!directory.isDirectory() || !directory.exists() ||
+ !directory.canRead()) {
+ if (DEBUG)
+ log(" Not found: "+ directory.getAbsolutePath());
+ return;
+ }
+ String filenames[] = directory.list();
+ for (int j = 0; j < filenames.length; j++) {
+ String filename = filenames[j].toLowerCase();
+ if (!filename.endsWith(".jar"))
+ continue;
+ File file = new File(directory, filenames[j]);
+ try {
+ URL url=file.toURL();
+ Module mod = new Module();
+ mod.setClasspath(new URL[] {url});
+ addModule(mod);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ }
}
/**
Modified:
tomcat/sandbox/java/org/apache/tomcat/util/loader/RepositoryClassLoader.java
URL:
http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/loader/RepositoryClassLoader.java?rev=409043&r1=409042&r2=409043&view=diff
==============================================================================
---
tomcat/sandbox/java/org/apache/tomcat/util/loader/RepositoryClassLoader.java
(original)
+++
tomcat/sandbox/java/org/apache/tomcat/util/loader/RepositoryClassLoader.java
Tue May 23 19:53:22 2006
@@ -17,9 +17,7 @@
package org.apache.tomcat.util.loader;
-import java.io.File;
import java.io.IOException;
-import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Enumeration;
@@ -38,8 +36,7 @@
* @author Remy Maucherat
* @author Craig R. McClanahan
*/
-public class RepositoryClassLoader
- extends URLClassLoader
+class RepositoryClassLoader extends URLClassLoader
{
private static final boolean DEBUG=false;
//LoaderProperties.getProperty("loader.debug.ModuleClassLoader") != null;
private static final boolean
DEBUGNF=false;//LoaderProperties.getProperty("loader.debug.ModuleClassLoaderNF")
!= null;
Modified: tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java
URL:
http://svn.apache.org/viewvc/tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java?rev=409043&r1=409042&r2=409043&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java
(original)
+++ tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java Tue May
23 19:53:22 2006
@@ -578,7 +578,7 @@
shouldRun = false;
this.p = p;
t = new ThreadWithAttributes(p, this);
- t.setDaemon(true);
+ t.setDaemon(p.isDaemon);
t.setName(p.getName() + "-Processor" + p.getSequence());
t.setPriority(p.getThreadPriority());
p.addThread( t, this );
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]