/** Exposed as public method for tests only */ public synchronized ScheduledExecutorService getScheduledExecutorService() { if (scheduledExecutorService == null) { scheduledExecutorService = Executors.newScheduledThreadPool("Commit Scheduler for index " + indexName); } return scheduledExecutorService; }
@Override public Future<?> start() { BatchCoordinator coordinator = createCoordinator(); ExecutorService executor = Executors.newFixedThreadPool(1, "batch coordinator"); try { Future<?> submit = executor.submit(coordinator); return submit; } finally { executor.shutdown(); } }
private synchronized ExecutorService getAsynchIndexingExecutorSynchronized() { ExecutorService executor = asyncIndexingExecutor; if (executor != null) { return executor; } else { this.asyncIndexingExecutor = Executors.newFixedThreadPool( 1, "Index updates queue processor for index " + indexName, maxQueueLength); return this.asyncIndexingExecutor; } }