diff --git a/remoting/src/main/java/hudson/remoting/Channel.java b/remoting/src/main/java/hudson/remoting/Channel.java index c9a42aafa17c1d08c1ea07fb552faed591109b9e..fb6904f4531afd3d1bc6ed922f7e3f2a67e9a95e 100644 --- a/remoting/src/main/java/hudson/remoting/Channel.java +++ b/remoting/src/main/java/hudson/remoting/Channel.java @@ -114,7 +114,7 @@ public class Channel implements VirtualChannel, IChannel { * and error reports. */ private final String name; - /*package*/ final boolean isRestricted; + private volatile boolean isRestricted; /*package*/ final ExecutorService executor; /** @@ -774,6 +774,17 @@ public class Channel implements VirtualChannel, IChannel { return inClosed!=null; } + /** + * Returns true if this channel is currently does not load classes from the remote peer. + */ + public boolean isRestricted() { + return isRestricted; + } + + public void setRestricted(boolean b) { + isRestricted = b; + } + /** * Waits for this {@link Channel} to be closed down, but only up the given milliseconds. * diff --git a/remoting/src/main/java/hudson/remoting/RemoteClassLoader.java b/remoting/src/main/java/hudson/remoting/RemoteClassLoader.java index d357cfd8dbb66ec65c09b6fde034fe0359899285..d1ed56f3692016235d687b624552b31620489ba7 100644 --- a/remoting/src/main/java/hudson/remoting/RemoteClassLoader.java +++ b/remoting/src/main/java/hudson/remoting/RemoteClassLoader.java @@ -45,7 +45,7 @@ import java.util.HashSet; * Loads class files from the other peer through {@link Channel}. * *
- * If the {@linkplain Channel#isRestricted channel is restricted}, this classloader will be
+ * If the {@linkplain Channel#isRestricted() channel is restricted}, this classloader will be
* created by will not attempt to load anything from the remote classloader. The reason we
* create such a useless instance is so that when such classloader is sent back to the remote side again,
* the remoting system can re-discover what {@link ClassLoader} this was tied to.
@@ -103,7 +103,7 @@ final class RemoteClassLoader extends URLClassLoader {
// first attempt to load from locally fetched jars
return super.findClass(name);
} catch (ClassNotFoundException e) {
- if(channel.isRestricted)
+ if(channel.isRestricted())
throw e;
// delegate to remote
if (channel.remoteCapability.supportsMultiClassLoaderRPC()) {
@@ -170,7 +170,7 @@ final class RemoteClassLoader extends URLClassLoader {
public URL findResource(String name) {
// first attempt to load from locally fetched jars
URL url = super.findResource(name);
- if(url!=null || channel.isRestricted) return url;
+ if(url!=null || channel.isRestricted()) return url;
try {
if(resourceMap.containsKey(name)) {
@@ -209,7 +209,7 @@ final class RemoteClassLoader extends URLClassLoader {
}
public Enumeration