public int getPoolExhaustedAction() { return null != poolExhaustedAction ? poolExhaustedAction : delegate.getPoolExhaustedAction(); }
protected void configureDispatcherPool() { // Normally having a the same maximum number of dispatcher objects as threads // is ok. int maxDispatchersActive = getDispatcherThreadingProfile().getMaxThreadsActive(); // BUT if the WHEN_EXHAUSTED_RUN threading profile exhausted action is // configured then a single // additional dispatcher is required that can be used by the caller thread // when it executes job's itself. // Also See: MULE-4752 if (ThreadingProfile.WHEN_EXHAUSTED_RUN == getDispatcherThreadingProfile().getPoolExhaustedAction()) { maxDispatchersActive++; } setMaxDispatchersActive(maxDispatchersActive); }
public ImmutableThreadingProfile(ThreadingProfile tp) { this(tp.getMaxThreadsActive(), tp.getMaxThreadsIdle(), tp.getMaxBufferSize(), tp.getThreadTTL(), tp.getThreadWaitTimeout(), tp.getPoolExhaustedAction(), tp.isDoThreading(), tp.getRejectedExecutionHandler(), tp.getThreadFactory()); }
public MutableThreadingProfile(ThreadingProfile tp) { this.maxThreadsActive = tp.getMaxThreadsActive(); this.maxThreadsIdle = tp.getMaxThreadsIdle(); this.maxBufferSize = tp.getMaxBufferSize(); this.threadTTL = tp.getThreadTTL(); this.threadWaitTimeout = tp.getThreadWaitTimeout(); this.poolExhaustedAction = tp.getPoolExhaustedAction(); this.doThreading = tp.isDoThreading(); this.rejectedExecutionHandler = tp.getRejectedExecutionHandler(); this.threadFactory = tp.getThreadFactory(); this.workManagerFactory = tp.getWorkManagerFactory(); this.poolFactory = tp.getPoolFactory(); }
private void configureThreadPoolExecutor(String name, ThreadingProfile tp, ThreadPoolExecutor pool) { configureThreadFactory(name, tp, pool); if (tp.getRejectedExecutionHandler() != null) { pool.setRejectedExecutionHandler(tp.getRejectedExecutionHandler()); } else { switch (tp.getPoolExhaustedAction()) { case ThreadingProfile.WHEN_EXHAUSTED_DISCARD_OLDEST : pool.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardOldestPolicy()); break; case ThreadingProfile.WHEN_EXHAUSTED_RUN : pool.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); break; case ThreadingProfile.WHEN_EXHAUSTED_ABORT : pool.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy()); break; case ThreadingProfile.WHEN_EXHAUSTED_DISCARD : pool.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy()); break; default : // WHEN_EXHAUSTED_WAIT pool.setRejectedExecutionHandler(new WaitPolicy(tp.getThreadWaitTimeout(), TimeUnit.MILLISECONDS)); break; } } }