/** * Set the threadpool. If the {@link ThreadPool} is a {@link LifeCycle}, * then it is started by this method. * * @param pool */ public void setThreadPool(ThreadPool pool) { try { if (pool instanceof LifeCycle) if (!((LifeCycle)pool).isStarted()) ((LifeCycle)pool).start(); } catch(Exception e) { throw new IllegalStateException(e); } _threadPool=pool; }
/** * Add a LifeCycle object to be started/stopped * along with the Server. * @param c */ public void addLifeCycle (LifeCycle c) { if (c == null) return; if (!_dependentLifeCycles.contains(c)) { _dependentLifeCycles.add(c); _container.addBean(c); } try { if (isStarted()) ((LifeCycle)c).start(); } catch (Exception e) { throw new RuntimeException (e); } }
protected void doStop() throws Exception { try{close();} catch(IOException e) {Log.warn(e);} if (_threadPool==_server.getThreadPool()) _threadPool=null; else if (_threadPool instanceof LifeCycle) ((LifeCycle)_threadPool).stop(); super.doStop(); Thread[] acceptors=null; synchronized(this) { acceptors=_acceptorThread; _acceptorThread=null; } if (acceptors != null) { for (int i=0;i<acceptors.length;i++) { Thread thread=acceptors[i]; if (thread!=null) thread.interrupt(); } } }
/** * Set the threadpool. * If the {@link ThreadPool} is a {@link LifeCycle}, then it is started by this method. * * @param pool */ public void setThreadPool(ThreadPool pool) { try { if (pool instanceof LifeCycle) if (!((LifeCycle)pool).isStarted()) ((LifeCycle)pool).start(); } catch(Exception e) { throw new IllegalStateException(e); } _threadPool = pool; }
_threadPool=_server.getThreadPool(); if (_threadPool!=_server.getThreadPool() && (_threadPool instanceof LifeCycle)) ((LifeCycle)_threadPool).start();