Skip to content
Permalink
Browse files

[JENKINS-35190] Added some logging.

  • Loading branch information
jglick committed May 27, 2016
1 parent c0cf331 commit 1fc3c930647fd9352c857fdd247c7d9b252dbc94
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/main/java/hudson/remoting/PingThread.java
@@ -32,6 +32,7 @@
import java.util.logging.Logger;

import static java.util.concurrent.TimeUnit.MILLISECONDS;
import java.util.logging.Level;

/**
* Periodically perform a ping.
@@ -101,15 +102,18 @@ public void run() {
}

private void ping() throws IOException, InterruptedException {
LOGGER.log(Level.FINE, "pinging {0}", channel.getName());
Future<?> f = channel.callAsync(new Ping());
long start = System.currentTimeMillis();

long end = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(timeout);
long remaining = end - System.nanoTime();

do {
LOGGER.log(Level.FINE, "waiting {0}s on {1}", new Object[] {TimeUnit.NANOSECONDS.toSeconds(remaining), channel.getName()});
try {
f.get(Math.max(1,remaining),TimeUnit.NANOSECONDS);
LOGGER.log(Level.FINE, "ping succeeded on {0}", channel.getName());
return;
} catch (ExecutionException e) {
if (e.getCause() instanceof RequestAbortedException)

0 comments on commit 1fc3c93

Please sign in to comment.
You can’t perform that action at this time.