Skip to content

Commit

Permalink
ForceNoCopy system property.
Browse files Browse the repository at this point in the history
  • Loading branch information
alesj committed Dec 27, 2007
1 parent 78c70ac commit dc14517
Showing 1 changed file with 27 additions and 1 deletion.
Expand Up @@ -34,6 +34,8 @@
import java.util.jar.JarFile;
import java.util.jar.JarEntry;
import java.util.zip.ZipEntry;
import java.security.PrivilegedAction;
import java.security.AccessController;

import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
import org.jboss.virtual.plugins.context.HierarchyVirtualFileHandler;
Expand All @@ -60,6 +62,18 @@ public abstract class AbstractStructuredJarHandler<T> extends AbstractJarHandler
private transient List<VirtualFileHandler> entries;
private transient Map<String, VirtualFileHandler> entryMap;

/**
* Force no copy nested jar handler.
*/
private static boolean forceNoCopy;

static
{
forceNoCopy = AccessController.doPrivileged(new CheckForceNoCopy());
if (forceNoCopy)
log.info("VFS force NoCopyJarHandler is enabled.");
}

/**
* Create a new JarHandler.
*
Expand Down Expand Up @@ -286,7 +300,7 @@ protected VirtualFileHandler createVirtualFileHandler(VirtualFileHandler parent,
String flag = context.getOptions().get("useNoCopyJarHandler");
boolean useNoCopyJarHandler = Boolean.valueOf(flag);

if (useNoCopyJarHandler)
if (useNoCopyJarHandler || forceNoCopy)
vfh = new NoCopyNestedJarHandler(context, parent, getJar(), entry, url, entryName);
else
vfh = NestedJarHandler.create(context, parent, getJar(), entry, url, entryName);
Expand Down Expand Up @@ -334,4 +348,16 @@ public ZipEntryWrapper<T> nextElement()
return new ZipEntryWrapper<T>(entry);
}
}

/**
* Check if force no copy system property exists.
*/
private static class CheckForceNoCopy implements PrivilegedAction<Boolean>
{
public Boolean run()
{
String forceString = System.getProperty("jboss.vfs.forceNoCopy", "false");
return Boolean.valueOf(forceString);
}
}
}

0 comments on commit dc14517

Please sign in to comment.