mirror of https://github.com/grpc/grpc-java.git
Make Benchmark Client terminate after running
This commit is contained in:
parent
d52429dffd
commit
509c7e7335
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
package io.grpc.benchmarks.qps;
|
package io.grpc.benchmarks.qps;
|
||||||
|
|
||||||
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
|
|
||||||
import io.grpc.ManagedChannel;
|
import io.grpc.ManagedChannel;
|
||||||
|
|
@ -61,6 +62,7 @@ import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
|
import java.util.concurrent.ThreadFactory;
|
||||||
|
|
||||||
import javax.net.ssl.SSLSocketFactory;
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
|
|
||||||
|
|
@ -175,21 +177,25 @@ final class Utils {
|
||||||
}
|
}
|
||||||
final EventLoopGroup group;
|
final EventLoopGroup group;
|
||||||
final Class<? extends io.netty.channel.Channel> channelType;
|
final Class<? extends io.netty.channel.Channel> channelType;
|
||||||
|
ThreadFactory tf = new ThreadFactoryBuilder()
|
||||||
|
.setDaemon(true)
|
||||||
|
.setNameFormat("ELG-%d")
|
||||||
|
.build();
|
||||||
switch (config.transport) {
|
switch (config.transport) {
|
||||||
case NETTY_NIO:
|
case NETTY_NIO:
|
||||||
group = new NioEventLoopGroup();
|
group = new NioEventLoopGroup(0, tf);
|
||||||
channelType = NioSocketChannel.class;
|
channelType = NioSocketChannel.class;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NETTY_EPOLL:
|
case NETTY_EPOLL:
|
||||||
// These classes only work on Linux.
|
// These classes only work on Linux.
|
||||||
group = new EpollEventLoopGroup();
|
group = new EpollEventLoopGroup(0, tf);
|
||||||
channelType = EpollSocketChannel.class;
|
channelType = EpollSocketChannel.class;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NETTY_UNIX_DOMAIN_SOCKET:
|
case NETTY_UNIX_DOMAIN_SOCKET:
|
||||||
// These classes only work on Linux.
|
// These classes only work on Linux.
|
||||||
group = new EpollEventLoopGroup();
|
group = new EpollEventLoopGroup(0, tf);
|
||||||
channelType = EpollDomainSocketChannel.class;
|
channelType = EpollDomainSocketChannel.class;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue