/** * Sets the {@link ThreadPoolConfig} * @param config * @return returns {@link GrizzlyExecutorService} */ public GrizzlyExecutorService reconfigure(ThreadPoolConfig config) { synchronized (statelock) { //TODO: only create new pool if old one cant be runtime config // for the needed state change(s). final ExtendedThreadPool oldpool = this.pool; if (config.getQueue() == oldpool.getQueue()) { config.setQueue(null); } setImpl(config); AbstractThreadPool.drain(oldpool.getQueue(), this.pool.getQueue()); oldpool.shutdown(); } return this; }
@SuppressWarnings("deprecation") protected ThreadPoolConfig updateFrom(ExtendedThreadPool ep) { this.queue = ep.getQueue(); this.threadFactory = ep.getThreadFactory(); this.poolName = ep.getName(); this.maxPoolSize = ep.getMaximumPoolSize(); //hiding internal values, due to they might not match configure //this.queueLimit = ep.getMaxQueuedTasksCount(); //this.corepoolsize = ep.getCorePoolSize(); //this.keepAliveTime = keepAliveTime; //this.timeUnit = timeUnit; //this.monitoringProbe = monitoringProbe; return this; }