public static String sqlToEsQuery(String sql) throws Exception { Map actions = new HashMap(); Settings settings = Settings.builder().build(); // Client client = new NodeClient(settings, null, null, actions); // Settings.builder() // .put(ThreadContext.PREFIX + ".key1", "val1") // .put(ThreadContext.PREFIX + ".key2", "val 2") // .build(); ThreadPool threadPool = new ThreadPool(settings); Client client = new NodeClient(settings, threadPool); SearchDao searchDao = new org.nlpcn.es4sql.SearchDao(client); try { return searchDao.explain(sql).explain().explain(); } catch (Exception e) { throw e; } }
.build(); final List<Closeable> resourcesToClose = new ArrayList<>(); final ThreadPool threadPool = new ThreadPool(settings); resourcesToClose.add(() -> ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS)); final NetworkService networkService = new NetworkService(Collections.emptyList());
@Override public ThreadPool threadPool() { // TODO flesh out client final ThreadPool dummyThreadPool = new ThreadPool("dummy"); return dummyThreadPool; }
(request, bulkListener) -> client.bulkAsync(request, bulkListener); threadPool = new ThreadPool(Settings.builder().put("node.name", "fscrawler-client").build()); bulkProcessor = new BulkProcessor.Builder(bulkConsumer, new DebugListener(logger), threadPool) .setBulkActions(settings.getElasticsearch().getBulkSize())
final ThreadPool threadPool = new ThreadPool(settings, executorBuilders.toArray(new ExecutorBuilder[0])); resourcesToClose.add(() -> ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS));
ThreadPool threadPool = new ThreadPool(); threadPool.setName(executorName.getKeyProperty("name")); threadPool.setMaxThreads(JmxTools.getIntAttr(server, executorName, "maxThreads")); threadPool.setMaxSpareThreads(JmxTools.getIntAttr(server, executorName, "largestPoolSize")); threadPool.setMinSpareThreads(JmxTools.getIntAttr(server, executorName, "minSpareThreads")); threadPool.setCurrentThreadsBusy(JmxTools.getIntAttr(server, executorName, "activeCount")); threadPool.setCurrentThreadCount(JmxTools.getIntAttr(server, executorName, "poolSize"));
public static String sqlToEsQuery(String sql) throws Exception { Map actions = new HashMap(); Settings settings = Settings.builder().build(); // Client client = new NodeClient(settings, null, null, actions); // Settings.builder() // .put(ThreadContext.PREFIX + ".key1", "val1") // .put(ThreadContext.PREFIX + ".key2", "val 2") // .build(); ThreadPool threadPool = new ThreadPool(settings); Client client = new NodeClient(settings, threadPool); SearchDao searchDao = new org.nlpcn.es4sql.SearchDao(client); try { return searchDao.explain(sql).explain().explain(); } catch (Exception e) { throw e; } }
.build(); final List<Closeable> resourcesToClose = new ArrayList<>(); final ThreadPool threadPool = new ThreadPool(settings); resourcesToClose.add(() -> ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS)); final NetworkService networkService = new NetworkService(Collections.emptyList());
final Settings settings = Settings.builder().put(defaultSettings).put(pluginsService.updatedSettings()).build(); final List<Closeable> resourcesToClose = new ArrayList<>(); final ThreadPool threadPool = new ThreadPool(settings); resourcesToClose.add(() -> ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS)); final NetworkService networkService = new NetworkService(settings, Collections.emptyList());
(request, bulkListener) -> client.bulkAsync(request, bulkListener); threadPool = new ThreadPool(Settings.builder().put("node.name", "fscrawler-client").build()); bulkProcessor = new BulkProcessor.Builder(bulkConsumer, new DebugListener(logger), threadPool) .setBulkActions(settings.getElasticsearch().getBulkSize())
final ThreadPool threadPool = new ThreadPool(settings, executorBuilders.toArray(new ExecutorBuilder[0])); resourcesToClose.add(() -> ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS));
final ThreadPool threadPool = new ThreadPool(settings, executorBuilders.toArray(new ExecutorBuilder[0])); resourcesToClose.add(() -> ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS));
final ThreadPool threadPool = new ThreadPool(settings); NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry();
final ThreadPool threadPool = new ThreadPool(settings, executorBuilders.toArray(new ExecutorBuilder[0])); resourcesToClose.add(() -> ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS));
final ThreadPool threadPool = new ThreadPool(settings); NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry();