@Override public int getQueueSize() { return getQueue().size(); }
private ManagedExecutorService createExecutor(String name, int poolSize, int queueCapacity, ExecutorType type) { ManagedExecutorService executor; if (type == ExecutorType.CACHED) { executor = new CachedExecutorServiceDelegate(nodeEngine, name, cachedExecutorService, poolSize, queueCapacity); } else if (type == ExecutorType.CONCRETE) { ClassLoader classLoader = nodeEngine.getConfigClassLoader(); String hzName = nodeEngine.getHazelcastInstance().getName(); String internalName = name.startsWith("hz:") ? name.substring(BEGIN_INDEX) : name; String threadNamePrefix = createThreadPoolName(hzName, internalName); PoolExecutorThreadFactory threadFactory = new PoolExecutorThreadFactory(threadNamePrefix, classLoader); NamedThreadPoolExecutor pool = new NamedThreadPoolExecutor(name, poolSize, poolSize, KEEP_ALIVE_TIME, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(queueCapacity), threadFactory ); pool.allowCoreThreadTimeOut(true); executor = pool; } else { throw new IllegalArgumentException("Unknown executor type: " + type); } return executor; }
private ManagedExecutorService createExecutor(String name, int poolSize, int queueCapacity, ExecutorType type) { ManagedExecutorService executor; if (type == ExecutorType.CACHED) { executor = new CachedExecutorServiceDelegate(nodeEngine, name, cachedExecutorService, poolSize, queueCapacity); } else if (type == ExecutorType.CONCRETE) { ClassLoader classLoader = nodeEngine.getConfigClassLoader(); String hzName = nodeEngine.getHazelcastInstance().getName(); String internalName = name.startsWith("hz:") ? name.substring(BEGIN_INDEX) : name; String threadNamePrefix = createThreadPoolName(hzName, internalName); PoolExecutorThreadFactory threadFactory = new PoolExecutorThreadFactory(threadNamePrefix, classLoader); NamedThreadPoolExecutor pool = new NamedThreadPoolExecutor(name, poolSize, poolSize, KEEP_ALIVE_TIME, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(queueCapacity), threadFactory ); pool.allowCoreThreadTimeOut(true); executor = pool; } else { throw new IllegalArgumentException("Unknown executor type: " + type); } return executor; }
@Override public int getQueueSize() { return getQueue().size(); }
@Override public int getRemainingQueueCapacity() { return getQueue().remainingCapacity(); }
@Override public int getRemainingQueueCapacity() { return getQueue().remainingCapacity(); }