--- java/org/apache/catalina/loader/WebappClassLoaderBase.java (revision 1816793) +++ java/org/apache/catalina/loader/WebappClassLoaderBase.java (working copy) @@ -371,6 +371,10 @@ */ protected long lastJarAccessed = 0L; + /** + * The interval in milliseconds that we can keep jar files open. + */ + protected int jarOpenInterval = 90000; /** * The list of local repositories, in the order they should be searched @@ -656,8 +660,22 @@ } + /** + * Set the interval to keep all jar files open + * @param jarOpenInterval the interval in milliseconds to keep jar files open + */ + public void setJarOpenInterval(int jarOpenInterval) { + this.jarOpenInterval = jarOpenInterval; + } /** + * Return the interval to keep all jar files open if no jar is accessed + */ + public int getJarOpenInterval() { + return jarOpenInterval; + } + + /** * @return Returns the antiJARLocking. */ public boolean getAntiJARLocking() { @@ -987,6 +1005,7 @@ base.contextName = this.contextName; base.hasExternalRepositories = this.hasExternalRepositories; base.searchExternalFirst = this.searchExternalFirst; + base.jarOpenInterval = this.jarOpenInterval; } @@ -2176,8 +2195,8 @@ public void closeJARs(boolean force) { if (jarFiles.length > 0) { synchronized (jarFiles) { - if (force || (System.currentTimeMillis() - > (lastJarAccessed + 90000))) { + if (force || (jarOpenInterval > 0 && System.currentTimeMillis() + > (lastJarAccessed + jarOpenInterval))) { for (int i = 0; i < jarFiles.length; i++) { try { if (jarFiles[i] != null) { --- java/org/apache/catalina/loader/WebappLoader.java (revision 1816793) +++ java/org/apache/catalina/loader/WebappLoader.java (working copy) @@ -137,6 +137,10 @@ */ private boolean delegate = false; + /** + * The interval in milliseconds to keep all jar files open if no jar is accessed + */ + private int jarOpenInterval = 90000; /** * The descriptive information about this Loader implementation. @@ -282,8 +286,23 @@ } + /** + * The interval to keep all jar files open if no jar is accessed + * + * @param jarOpenInterval The new interval + */ + public void setJarOpenInterval(int jarOpenInterval) { + this.jarOpenInterval = jarOpenInterval; + } /** + * Return the interval to keep all jar files open if no jar is accessed + */ + public int getJarOpenInterval() { + return jarOpenInterval; + } + + /** * Return descriptive information about this Loader implementation and * the corresponding version number, in the format * <description>/<version>. @@ -580,6 +599,7 @@ try { classLoader = createClassLoader(); + classLoader.setJarOpenInterval(this.jarOpenInterval); classLoader.setResources(container.getResources()); classLoader.setDelegate(this.delegate); classLoader.setSearchExternalFirst(searchExternalFirst); --- java/org/apache/catalina/loader/mbeans-descriptors.xml (revision 1816793) +++ java/org/apache/catalina/loader/mbeans-descriptors.xml (working copy) @@ -169,6 +169,10 @@ writeable="false" type="java.lang.String"/> + + + +