incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/7] git commit: Switched thrift server to thread pool server.
Date Sun, 31 Mar 2013 15:10:54 GMT
Switched thrift server to thread pool server.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/79851401
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/79851401
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/79851401

Branch: refs/heads/0.1.5
Commit: 7985140161aa5918893b009eaec86acd32078405
Parents: c3fd23d
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sun Mar 31 10:14:31 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun Mar 31 10:14:31 2013 -0400

----------------------------------------------------------------------
 .../java/org/apache/blur/thrift/ThriftServer.java  |   55 +++++++--------
 1 files changed, 27 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/79851401/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java b/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
index 71eaa64..79724b0 100644
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java
@@ -23,20 +23,19 @@ import java.io.InputStreamReader;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.Map;
 import java.util.concurrent.ExecutorService;
 
 import org.apache.blur.BlurConfiguration;
-import org.apache.blur.concurrent.Executors;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
 import org.apache.blur.manager.indexserver.BlurServerShutDown.BlurShutdown;
-import org.apache.blur.thrift.ExecutorServicePerMethodCallThriftServer.Args;
 import org.apache.blur.thrift.generated.Blur;
 import org.apache.blur.thrift.generated.Blur.Iface;
+import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.server.TServer;
-import org.apache.thrift.transport.TNonblockingServerSocket;
+import org.apache.thrift.server.TThreadPoolServer;
+import org.apache.thrift.transport.TFramedTransport;
+import org.apache.thrift.transport.TServerSocket;
 import org.apache.thrift.transport.TTransportException;
 
 public class ThriftServer {
@@ -99,29 +98,29 @@ public class ThriftServer {
 
   public void start() throws TTransportException {
     Blur.Processor<Blur.Iface> processor = new Blur.Processor<Blur.Iface>(_iface);
-    // TServerSocket serverTransport = new
-    // TServerSocket(getBindInetSocketAddress(_configuration));
-    //
-    // TThreadPoolServer.Args args = new
-    // TThreadPoolServer.Args(serverTransport);
-    // args.processor(processor);
-    // args.transportFactory(new TFramedTransport.Factory());
-    // args.protocolFactory(new TBinaryProtocol.Factory(true, true));
-    // _server = new TThreadPoolServer(args);
-    TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(getBindInetSocketAddress(_configuration));
-
-    Args args = new Args(serverTransport);
-    args.processor(processor);
-    _executorService = Executors.newThreadPool("thrift-processors", _threadCount);
-    args.executorService(_executorService);
-    Map<String, ExecutorService> methodCallsToExecutorService = new HashMap<String,
ExecutorService>();
-    _mutateExecutorService = Executors.newThreadPool("thrift-processors-mutate", _threadCount);
-    methodCallsToExecutorService.put("mutate", _mutateExecutorService);
-    methodCallsToExecutorService.put("mutateBatch", _mutateExecutorService);
-    _queryExexutorService = Executors.newThreadPool("thrift-processors-query", _threadCount);
-    methodCallsToExecutorService.put("query", _queryExexutorService);
-    args.setMethodCallsToExecutorService(methodCallsToExecutorService);
-    _server = new ExecutorServicePerMethodCallThriftServer(args);
+     TServerSocket serverTransport = new
+     TServerSocket(getBindInetSocketAddress(_configuration));
+    
+     TThreadPoolServer.Args args = new
+     TThreadPoolServer.Args(serverTransport);
+     args.processor(processor);
+     args.transportFactory(new TFramedTransport.Factory());
+     args.protocolFactory(new TBinaryProtocol.Factory(true, true));
+     _server = new TThreadPoolServer(args);
+//    TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(getBindInetSocketAddress(_configuration));
+
+//    Args args = new Args(serverTransport);
+//    args.processor(processor);
+//    _executorService = Executors.newThreadPool("thrift-processors", _threadCount);
+//    args.executorService(_executorService);
+//    Map<String, ExecutorService> methodCallsToExecutorService = new HashMap<String,
ExecutorService>();
+//    _mutateExecutorService = Executors.newThreadPool("thrift-processors-mutate", _threadCount);
+//    methodCallsToExecutorService.put("mutate", _mutateExecutorService);
+//    methodCallsToExecutorService.put("mutateBatch", _mutateExecutorService);
+//    _queryExexutorService = Executors.newThreadPool("thrift-processors-query", _threadCount);
+//    methodCallsToExecutorService.put("query", _queryExexutorService);
+//    args.setMethodCallsToExecutorService(methodCallsToExecutorService);
+//    _server = new ExecutorServicePerMethodCallThriftServer(args);
     LOG.info("Starting server [{0}]", _nodeName);
     _server.serve();
   }


Mime
View raw message