public final class URLConnectionCaches
extends java.lang.Object
https://bugs.eclipse.org/bugs/show_bug.cgi?id=442524
,
http://bugs.java.com/view_bug.do?bug_id=6207022
Modifier and Type | Field and Description |
---|---|
private static java.net.URLConnection |
conn |
private static org.slf4j.Logger |
log |
Modifier | Constructor and Description |
---|---|
private |
URLConnectionCaches() |
Modifier and Type | Method and Description |
---|---|
static void |
assertDisabled() |
static void |
disable()
Disables caching of URLConnections by default.
|
private static final org.slf4j.Logger log
private static final java.net.URLConnection conn
public static void disable()
According to JDK bug 6207022, JVM caches opened jar files, which results in JVM crashes or other unpredictable results if the jar are closed, overwritten and reopened.
This workaround disables URLConnection caching for all protocols, not just jar files, which may result in performance problems for other URLConnection clients. There is also no way to guarantee that other code does not reenable caching of URLConnections.
Longer term solution is likely two fold. First, always create unique copies of jar files passed to Maven class
realms. Second, use URLConnection.setUseCaches(boolean)
to false for all jar files opened by Maven and
Sisu. Both require significant effort, however.
public static void assertDisabled()