public WorkPool(int threads, int maxQueued, String poolName) { BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<Runnable>(maxQueued) { private static final long serialVersionUID = 1L; @Override public boolean offer(Runnable e) { try { put(e); } catch (InterruptedException e1) { throw new RuntimeException(e1); } return true; } }; pool = MoreExecutors .listeningDecorator(new ThreadPoolExecutor(threads, threads, 0L, TimeUnit.MILLISECONDS, workQueue, new LumongoThreadFactory(poolName))); }
public LumongoIndexManager(MongoClient mongo, MongoConfig mongoConfig, ClusterConfig clusterConfig) throws UnknownHostException { this.globalLock = new ReentrantReadWriteLock(true); this.mongoConfig = mongoConfig; this.clusterConfig = clusterConfig; this.indexMap = new ConcurrentHashMap<>(); this.mongo = mongo; this.clusterHelper = new ClusterHelper(mongo, mongoConfig.getDatabaseName()); this.internalClient = new InternalClient(clusterHelper, clusterConfig); this.pool = Executors.newCachedThreadPool(new LumongoThreadFactory("manager")); queryNumber = new AtomicLong(); }
this.segmentPool = Executors.newCachedThreadPool(new LumongoThreadFactory(indexName + "-segments"));