core: Wrap keepalive runnables with exception logging

executor.schedule() will "eat" any exceptions thrown by the Runnables,
because the Future is expected to be used to see them. However, we never
call get() on the Future, so we need to just the exceptions like we do
elsewhere in this case.
This commit is contained in:
Eric Anderson 2017-03-30 13:46:33 -07:00
parent 0bcf921e20
commit d4c9d5f087
1 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ public class KeepAliveManager {
private long nextKeepaliveTime; private long nextKeepaliveTime;
private ScheduledFuture<?> shutdownFuture; private ScheduledFuture<?> shutdownFuture;
private ScheduledFuture<?> pingFuture; private ScheduledFuture<?> pingFuture;
private final Runnable shutdown = new Runnable() { private final Runnable shutdown = new LogExceptionRunnable(new Runnable() {
@Override @Override
public void run() { public void run() {
boolean shouldShutdown = false; boolean shouldShutdown = false;
@ -71,8 +71,8 @@ public class KeepAliveManager {
keepAlivePinger.onPingTimeout(); keepAlivePinger.onPingTimeout();
} }
} }
}; });
private final Runnable sendPing = new Runnable() { private final Runnable sendPing = new LogExceptionRunnable(new Runnable() {
@Override @Override
public void run() { public void run() {
boolean shouldSendPing = false; boolean shouldSendPing = false;
@ -95,7 +95,7 @@ public class KeepAliveManager {
keepAlivePinger.ping(); keepAlivePinger.ping();
} }
} }
}; });
private long keepAliveDelayInNanos; private long keepAliveDelayInNanos;
private long keepAliveTimeoutInNanos; private long keepAliveTimeoutInNanos;