Moving the tmp file logic to ThriftServer and changing the thread pool executor in the sasl setup to not watch threads.
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/3175976e Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/3175976e Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/3175976e Branch: refs/heads/master Commit: 3175976e4555f8b92b6c957be47eb2ecbadd1a9e Parents: 44ff932 Author: Aaron McCurry <[email protected]> Authored: Wed Mar 4 08:51:30 2015 -0500 Committer: Aaron McCurry <[email protected]> Committed: Wed Mar 4 08:51:30 2015 -0500 ---------------------------------------------------------------------- .../apache/blur/thrift/ThriftBlurShardServer.java | 10 +--------- .../java/org/apache/blur/thrift/ThriftServer.java | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/3175976e/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java index d8f15b0..5a7346d 100644 --- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java +++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java @@ -52,7 +52,6 @@ import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_THRIFT_MAX_READ_BUF import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_THRIFT_SELECTOR_THREADS; import static org.apache.blur.utils.BlurConstants.BLUR_THRIFT_DEFAULT_MAX_FRAME_SIZE; import static org.apache.blur.utils.BlurConstants.BLUR_THRIFT_MAX_FRAME_SIZE; -import static org.apache.blur.utils.BlurConstants.BLUR_TMP_PATH; import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_CONNECTION; import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_TIMEOUT; import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_TIMEOUT_DEFAULT; @@ -245,14 +244,7 @@ public class ThriftBlurShardServer extends ThriftServer { fetchCount, indexManagerThreadCount, mutateThreadCount, statusCleanupTimerDelay, facetThreadCount, deepPagingCache); - File defaultTmpPath = getDefaultTmpPath(BLUR_TMP_PATH); - String configTmpPath = configuration.get(BLUR_TMP_PATH); - File tmpPath; - if (!(configTmpPath == null || configTmpPath.isEmpty())) { - tmpPath = new File(configTmpPath); - } else { - tmpPath = defaultTmpPath; - } + File tmpPath = getTmpPath(configuration); int numberOfShardWorkerCommandThreads = configuration.getInt(BLUR_SHARD_COMMAND_WORKER_THREADS, 16); int numberOfShardDriverCommandThreads = configuration.getInt(BLUR_SHARD_COMMAND_DRIVER_THREADS, 16); String commandPath = configuration.get(BLUR_COMMAND_LIB_PATH, getCommandLibPath()); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/3175976e/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java index 0204e98..6e79afa 100644 --- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java +++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftServer.java @@ -25,6 +25,7 @@ import static org.apache.blur.metrics.MetricsConstants.SYSTEM; import static org.apache.blur.utils.BlurConstants.BLUR_HDFS_TRACE_PATH; import static org.apache.blur.utils.BlurConstants.BLUR_HOME; import static org.apache.blur.utils.BlurConstants.BLUR_SERVER_SECURITY_FILTER_CLASS; +import static org.apache.blur.utils.BlurConstants.BLUR_TMP_PATH; import java.io.BufferedReader; import java.io.File; @@ -134,6 +135,18 @@ public class ThriftServer { return System.getenv(BLUR_HOME); } + public static File getTmpPath(BlurConfiguration configuration) throws IOException { + File defaultTmpPath = getDefaultTmpPath(BLUR_TMP_PATH); + String configTmpPath = configuration.get(BLUR_TMP_PATH); + File tmpPath; + if (!(configTmpPath == null || configTmpPath.isEmpty())) { + tmpPath = new File(configTmpPath); + } else { + tmpPath = defaultTmpPath; + } + return tmpPath; + } + public static File getDefaultTmpPath(String propName) throws IOException { String blurHomeDir = getBlurHomeDir(); File tmp; @@ -278,10 +291,9 @@ public class ThriftServer { } public void start() throws TTransportException, IOException { - _executorService = Executors.newThreadPool("thrift-processors", _threadCount); Blur.Processor<Blur.Iface> processor = new Blur.Processor<Blur.Iface>(_iface); - if (SaslHelper.isSaslEnabled(_configuration)) { + _executorService = Executors.newThreadPool("thrift-processors", _threadCount, false); TSaslServerTransport.Factory saslTransportFactory = SaslHelper.getTSaslServerTransportFactory(_configuration); Args args = new TThreadPoolServer.Args(_serverTransport); args.executorService(_executorService); @@ -292,6 +304,7 @@ public class ThriftServer { _server = new TThreadPoolServer(args); _server.setServerEventHandler(_eventHandler); } else { + _executorService = Executors.newThreadPool("thrift-processors", _threadCount); TThreadedSelectorServer.Args args = new TThreadedSelectorServer.Args( (TNonblockingServerTransport) _serverTransport); args.processor(processor);
