public int getMaxThreadsIdle() { return null != maxThreadsIdle ? maxThreadsIdle : delegate.getMaxThreadsIdle(); }
protected ThreadPoolExecutor internalCreatePool(String name, ThreadingProfile tp, BlockingQueue buffer) { return new ThreadPoolExecutor(Math.min(tp.getMaxThreadsIdle(), tp.getMaxThreadsActive()), tp.getMaxThreadsActive(), tp.getThreadTTL(), TimeUnit.MILLISECONDS, buffer); }
protected ScheduledThreadPoolExecutor internalCreateScheduledPool(ThreadingProfile tp) { ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(tp.getMaxThreadsIdle()); scheduledThreadPoolExecutor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); scheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(true); scheduledThreadPoolExecutor.setKeepAliveTime(tp.getThreadTTL(), TimeUnit.MILLISECONDS); return scheduledThreadPoolExecutor; } }
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(); }
@Override protected void doInitialise() throws InitialisationException { if (tcpProtocol != null) { try { muleContext.getInjector().inject(getTcpProtocol()); } catch (MuleException e) { throw new InitialisationException(e, this); } } socketFactory.setConnectionTimeout(getConnectionTimeout()); socketsPool.setFactory(getSocketFactory()); socketsPool.setTestOnBorrow(true); socketsPool.setTestOnReturn(true); socketsPool.setMaxActive(getDispatcherThreadingProfile().getMaxThreadsActive()); socketsPool.setMaxIdle(getDispatcherThreadingProfile().getMaxThreadsIdle()); socketsPool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK); socketsPool.setMaxWait(socketMaxWait); // Use connector's classloader so that other temporary classloaders // aren't used when things are started lazily or from elsewhere. final String monitorName = String.format("%s%s.socket", ThreadNameHelper.getPrefix(muleContext), getName()); keepAliveMonitor = new ExpiryMonitor(monitorName, 1000, this.getClass().getClassLoader(), muleContext, false); }