remm 2004/07/26 08:52:17 Modified: catalina/src/share/org/apache/catalina/loader WebappClassLoader.java WebappLoader.java Log: - Update to use a flag for the anti JAR locking code. It isn't as foolproof as the other one, since you can't just delete a WAR or expanded folder to undeploy (on Windows, of course). - I think the two flags together will cover all the needs. Revision Changes Path 1.40 +37 -12 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java Index: WebappClassLoader.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- WebappClassLoader.java 23 Jul 2004 22:40:11 -0000 1.39 +++ WebappClassLoader.java 26 Jul 2004 15:52:17 -0000 1.40 @@ -160,6 +160,13 @@ protected static final StringManager sm = StringManager.getManager(Constants.Package); + + /** + * Use anti JAR locking code, which does URL rerouting when accessing + * resources. + */ + boolean antiJARLocking = false; + // ----------------------------------------------------------- Constructors @@ -405,6 +412,22 @@ /** + * @return Returns the antiJARLocking. + */ + public boolean getAntiJARLocking() { + return antiJARLocking; + } + + + /** + * @param antiJARLocking The antiJARLocking to set. + */ + public void setAntiJARLocking(boolean antiJARLocking) { + this.antiJARLocking = antiJARLocking; + } + + + /** * If there is a Java SecurityManager create a read FilePermission * or JndiPermission for the file directory path. * @@ -1027,17 +1050,19 @@ if (url != null) { // Locating the repository for special handling in the case // of a JAR - ResourceEntry entry = (ResourceEntry) resourceEntries.get(name); - try { - String repository = entry.codeBase.toString(); - if ((repository.endsWith(".jar")) - && (!(name.endsWith(".class")))) { - // Copy binary content to the work directory if not present - File resourceFile = new File(loaderDir, name); - url = resourceFile.toURL(); + if (antiJARLocking) { + ResourceEntry entry = (ResourceEntry) resourceEntries.get(name); + try { + String repository = entry.codeBase.toString(); + if ((repository.endsWith(".jar")) + && (!(name.endsWith(".class")))) { + // Copy binary content to the work directory if not present + File resourceFile = new File(loaderDir, name); + url = resourceFile.toURL(); + } + } catch (Exception e) { + // Ignore } - } catch (Exception e) { - // Ignore } if (log.isDebugEnabled()) log.debug(" --> Returning '" + url.toString() + "'"); @@ -1766,7 +1791,7 @@ } // Extract resources contained in JAR to the workdir - if (!(path.endsWith(".class"))) { + if (antiJARLocking && !(path.endsWith(".class"))) { byte[] buf = new byte[1024]; File resourceFile = new File (loaderDir, jarEntry.getName()); 1.31 +3 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java Index: WebappLoader.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- WebappLoader.java 23 Jul 2004 22:40:11 -0000 1.30 +++ WebappLoader.java 26 Jul 2004 15:52:17 -0000 1.31 @@ -645,6 +645,8 @@ classLoader = createClassLoader(); classLoader.setResources(container.getResources()); classLoader.setDelegate(this.delegate); + if (container instanceof StandardContext) + classLoader.setAntiJARLocking(((StandardContext) container).getAntiJARLocking()); for (int i = 0; i < repositories.length; i++) { classLoader.addRepository(repositories[i]);
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]