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