List of usage examples for java.util.concurrent ThreadPoolExecutor getThreadFactory
public ThreadFactory getThreadFactory()
From source file:xyz.cloudbans.client.Clients.java
public static Client create(ThreadPoolExecutor executor, ClientConfig config) { return create(executor.getThreadFactory(), config); }
From source file:Main.java
public static ExecutorService newFixedThreadPool(String name, int numThreads, int maxPoolSize, int keepAliveTimeInSeconds) { LinkedBlockingQueue<Runnable> lbq = new LinkedBlockingQueue<Runnable>(); ThreadFactory tf = newNamedThreadFactory(name); ThreadPoolExecutor tpe = new ThreadPoolExecutor(numThreads, maxPoolSize, keepAliveTimeInSeconds, TimeUnit.SECONDS, lbq, tf); return Executors.newFixedThreadPool(numThreads, tpe.getThreadFactory()); }
From source file:org.mule.service.scheduler.internal.executor.ByCallerThreadGroupPolicy.java
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { ThreadGroup targetGroup = ((SchedulerThreadFactory) executor.getThreadFactory()).getGroup(); ThreadGroup currentThreadGroup = currentThread().getThreadGroup(); ++rejectedCount;/*from ww w.j av a 2s . c o m*/ if ((isRunCpuLightWhenTargetBusyThread(currentThreadGroup) && targetGroup == couLightGroup) || (isWaitGroupThread(targetGroup) && targetGroup == currentThreadGroup)) { if (isLogRejectionEnabled()) { logRejection(r.toString(), callerRuns.getClass().getSimpleName(), targetGroup.getName()); } callerRuns.rejectedExecution(r, executor); } else if (!isSchedulerThread(currentThreadGroup) || isWaitGroupThread(currentThreadGroup)) { if (isLogRejectionEnabled()) { logRejection(r.toString(), wait.getClass().getSimpleName(), targetGroup.getName()); } // MULE-11460 Make CPU-intensive pool a ForkJoinPool - keep the parallelism when waiting. wait.rejectedExecution(r, executor); } else { if (isLogRejectionEnabled()) { logRejection(r.toString(), abort.getClass().getSimpleName(), targetGroup.getName()); } abort.rejectedExecution(r, executor); } }