Code example for ScheduledThreadPoolExecutor

Methods: setCorePoolSize

0
        this.keepAlive = keepAlive;
    } 
 
    public synchronized void start(final StartContext context) throws StartException {
        ScheduledThreadPoolExecutor scheduledExecutor = new ExecutorImpl(0, threadFactoryValue.getValue());
        scheduledExecutor.setCorePoolSize(maxThreads);
        if(keepAlive != null)
            scheduledExecutor.setKeepAliveTime(keepAlive.getDuration(), keepAlive.getUnit());
        executor = new ManagedScheduledExecutorService(scheduledExecutor);
    } 
 
    public synchronized void stop(final StopContext context) {
        final ManagedScheduledExecutorService executor = getValue();
        this.context = context;
        context.asynchronous();
        executor.internalShutdown();
        this.executor = null;
    } 
 
    public synchronized ManagedScheduledExecutorService getValue() throws IllegalStateException {