(THRIFT-5) A TNonblockingServers (single-threaded and thread-pool) for Java
This patch adds two Thrift servers for Java that both use non-blocking I/O
to avoid locking up worker threads for idle connections. The two classes are
- TNonblockingServer, which supports single-threaded serving
- THsHaServer, which performs I/O in one thread and method invocations in
a configurable thread pool.
To support these servers, TNonblockingServerSocket and TNonblockingSocket
have been added.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@673550 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/java/src/TestClient.java b/test/java/src/TestClient.java
index 379761d..bc76e83 100644
--- a/test/java/src/TestClient.java
+++ b/test/java/src/TestClient.java
@@ -38,6 +38,8 @@
boolean framedInput = true;
boolean framedOutput = true;
+ int socketTimeout = 1000;
+
try {
for (int i = 0; i < args.length; ++i) {
if (args[i].equals("-h")) {
@@ -53,6 +55,8 @@
url = args[++i];
} else if (args[i].equals("-n")) {
numTests = Integer.valueOf(args[++i]);
+ } else if (args[i].equals("-timeout")) {
+ socketTimeout = Integer.valueOf(args[++i]);
}
}
} catch (Exception x) {
@@ -65,7 +69,7 @@
transport = new THttpClient(url);
} else {
TSocket socket = new TSocket(host, port);
- socket.setTimeout(1000);
+ socket.setTimeout(socketTimeout);
transport = socket;
if (framed) {
transport = new TFramedTransport(transport,