@Override protected void initInternal() throws LifecycleException { BlockingQueue<Runnable> startStopQueue = new LinkedBlockingQueue<Runnable>(); startStopExecutor = new ThreadPoolExecutor( getStartStopThreadsInternal(), getStartStopThreadsInternal(), 10, TimeUnit.SECONDS, startStopQueue); startStopExecutor.allowCoreThreadTimeOut(true); super.initInternal(); }
@Override public void setStartStopThreads(int startStopThreads) { this.startStopThreads = startStopThreads; // Use local copies to ensure thread safety ThreadPoolExecutor executor = startStopExecutor; if (executor != null) { int newThreads = getStartStopThreadsInternal(); executor.setMaximumPoolSize(newThreads); executor.setCorePoolSize(newThreads); } }
@Override public void setStartStopThreads(int startStopThreads) { int oldStartStopThreads = this.startStopThreads; this.startStopThreads = startStopThreads; // Use local copies to ensure thread safety if (oldStartStopThreads != startStopThreads && startStopExecutor != null) { reconfigureStartStopExecutor(getStartStopThreadsInternal()); } }
@Override public void setStartStopThreads(int startStopThreads) { this.startStopThreads = startStopThreads; // Use local copies to ensure thread safety ThreadPoolExecutor executor = startStopExecutor; if (executor != null) { int newThreads = getStartStopThreadsInternal(); executor.setMaximumPoolSize(newThreads); executor.setCorePoolSize(newThreads); } }
@Override public void setStartStopThreads(int startStopThreads) { this.startStopThreads = startStopThreads; // Use local copies to ensure thread safety ThreadPoolExecutor executor = startStopExecutor; if (executor != null) { int newThreads = getStartStopThreadsInternal(); executor.setMaximumPoolSize(newThreads); executor.setCorePoolSize(newThreads); } }
@Override protected void initInternal() throws LifecycleException { BlockingQueue<Runnable> startStopQueue = new LinkedBlockingQueue<>(); startStopExecutor = new ThreadPoolExecutor( getStartStopThreadsInternal(), getStartStopThreadsInternal(), 10, TimeUnit.SECONDS, startStopQueue, new StartStopThreadFactory(getName() + "-startStop-")); startStopExecutor.allowCoreThreadTimeOut(true); super.initInternal(); }
@Override protected void initInternal() throws LifecycleException { BlockingQueue<Runnable> startStopQueue = new LinkedBlockingQueue<Runnable>(); startStopExecutor = new ThreadPoolExecutor( getStartStopThreadsInternal(), getStartStopThreadsInternal(), 10, TimeUnit.SECONDS, startStopQueue, new StartStopThreadFactory(getName() + "-startStop-")); startStopExecutor.allowCoreThreadTimeOut(true); super.initInternal(); }
@Override protected void initInternal() throws LifecycleException { reconfigureStartStopExecutor(getStartStopThreadsInternal()); super.initInternal(); }