Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -580,21 +580,6 @@ private static class StartWatching extends MasterToSlaveFileCallable<Void> {

}

// 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;
Expand Down Expand Up @@ -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);
Expand Down