mirror of https://github.com/grpc/grpc-java.git
Daemonize InProcess threads
This commit is contained in:
parent
6a782a035e
commit
5d34599390
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue