diff --git a/src/main/java/org/jenkinsci/plugins/durabletask/FileMonitoringTask.java b/src/main/java/org/jenkinsci/plugins/durabletask/FileMonitoringTask.java index b5a85d4d..a8f7c8ac 100644 --- a/src/main/java/org/jenkinsci/plugins/durabletask/FileMonitoringTask.java +++ b/src/main/java/org/jenkinsci/plugins/durabletask/FileMonitoringTask.java @@ -580,21 +580,6 @@ private static class StartWatching extends MasterToSlaveFileCallable { } - // TODO https://github.com/jenkinsci/remoting/pull/657 - private static boolean isClosedChannelException(Throwable t) { - if (t instanceof ClosedChannelException) { - return true; - } else if (t instanceof ChannelClosedException) { - return true; - } else if (t instanceof EOFException) { - return true; - } else if (t == null) { - return false; - } else { - return isClosedChannelException(t.getCause()) || Stream.of(t.getSuppressed()).anyMatch(FileMonitoringTask::isClosedChannelException); - } - } - private static class Watcher implements Runnable { private final FileMonitoringController controller; @@ -667,7 +652,7 @@ private static class Watcher implements Runnable { } } catch (Exception x) { // note that LOGGER here is going to the agent log, not master log - if (isClosedChannelException(x)) { + if (Channel.isClosedChannelException(x)) { LOGGER.warning(() -> this + " giving up on watching " + controller.controlDir); } else { LOGGER.log(Level.WARNING, this + " giving up on watching " + controller.controlDir, x);