Daemonize InProcess threads

This commit is contained in:
Carl Mastrangelo 2015-09-03 14:51:09 -07:00
parent 6a782a035e
commit 5d34599390
1 changed files with 10 additions and 4 deletions

View File

@ -85,7 +85,7 @@ class InProcessTransport implements ServerTransport, ClientTransport {
if (serverTransportListener == null) {
shutdownStatus = Status.UNAVAILABLE.withDescription("Could not find server: " + name);
final Status localShutdownStatus = shutdownStatus;
new Thread(new Runnable() {
Thread shutdownThread = new Thread(new Runnable() {
@Override
public void run() {
synchronized (InProcessTransport.this) {
@ -93,16 +93,22 @@ class InProcessTransport implements ServerTransport, ClientTransport {
notifyTerminated();
}
}
}).start();
});
shutdownThread.setDaemon(true);
shutdownThread.setName("grpc-inprocess-shutdown");
shutdownThread.start();
}
new Thread(new Runnable() {
Thread readyThread = new Thread(new Runnable() {
@Override
public void run() {
synchronized (InProcessTransport.this) {
clientTransportListener.transportReady();
}
}
}).start();
});
readyThread.setDaemon(true);
readyThread.setName("grpc-inprocess-ready");
readyThread.start();
}
@Override