handle legacy slave.jar gracefully

This commit is contained in:
Kohsuke Kawaguchi committed 2011-05-10 16:21:10 -07:00
1 parent 9e69d9a95b
commit fc5aa88b66
2 files changed
+28 -2

No files matched your search

+25 -2
View File
@@ -39,6 +39,7 @@ import hudson.remoting.Pipe;
import hudson.remoting.RemoteOutputStream;
import hudson.remoting.VirtualChannel;
import hudson.remoting.RemoteInputStream;
import hudson.remoting.Which;
import hudson.security.AccessControlled;
import hudson.util.DirScanner;
import hudson.util.IOException2;
@@ -85,6 +86,7 @@ import java.util.List;
import java.util.StringTokenizer;
import java.util.Arrays;
import java.util.Comparator;
import java.util.logging.Level;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.concurrent.ExecutionException;
@@ -1419,8 +1421,29 @@ public final class FilePath implements Serializable {
});
// make sure the write fully happens before we return.
if (channel!=null)
channel.syncLocalIO();
syncIO();
}
private void syncIO() throws InterruptedException {
try {
if (channel!=null)
_syncIO();
} catch (AbstractMethodError e) {
// legacy slave.jar. Handle this gracefully
try {
LOGGER.log(Level.WARNING,"Looks like an old slave.jar. Please update "+ Which.jarFile(Channel.class)+" to the new version",e);
} catch (IOException _) {
// really ignore this time
}
}
}
/**
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
* on BugParade for more details.
*/
private void _syncIO() throws InterruptedException {
channel.syncLocalIO();
}
/**