Merge pull request #1687 from grpc/java_qps_take_two

Fix QpsWorker shutdown properly
This commit is contained in:
Jan Tattermusch 2016-04-18 16:59:21 -07:00 committed by Carl Mastrangelo
parent 6b2727b181
commit 4a0c110f7d
1 changed files with 7 additions and 3 deletions

View File

@ -31,6 +31,8 @@
package io.grpc.benchmarks.driver;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.grpc.Status;
import io.grpc.benchmarks.proto.Control;
import io.grpc.benchmarks.proto.WorkerServiceGrpc;
@ -55,7 +57,11 @@ public class LoadWorker {
LoadWorker(int driverPort, int serverPort) throws Exception {
this.serverPort = serverPort;
NioEventLoopGroup singleThreadGroup = new NioEventLoopGroup(1);
NioEventLoopGroup singleThreadGroup = new NioEventLoopGroup(1,
new ThreadFactoryBuilder()
.setDaemon(true)
.setNameFormat("load-worker-%d")
.build());
this.driverServer = NettyServerBuilder.forPort(driverPort)
.directExecutor()
.workerEventLoopGroup(singleThreadGroup)
@ -119,9 +125,7 @@ public class LoadWorker {
log.log(Level.INFO, "DriverServer has terminated.");
// Allow enough time for quitWorker to deliver OK status to the driver.
// Also make sure this process actually exits (see #1685).
Thread.sleep(3000);
System.exit(0);
}
/**