@Override public final void start() throws Exception { synchronized (_lock) { try { if (_state == __STARTED || _state == __STARTING) return; setStarting(); doStart(); setStarted(); } catch (Throwable e) { setFailed(e); throw e; } } }
@Override public final void stop() throws Exception { synchronized (_lock) { try { if (_state == __STOPPING || _state == __STOPPED) return; setStopping(); doStop(); setStopped(); } catch (Throwable e) { setFailed(e); throw e; } } }
@Override public String toString() { Class<?> clazz = getClass(); String name = clazz.getSimpleName(); if ((name==null || name.length()==0) && clazz.getSuperclass()!=null) { clazz = clazz.getSuperclass(); name = clazz.getSimpleName(); } return String.format("%s@%x{%s}",name,hashCode(),getState()); } }
@Override protected void doStart() throws Exception { super.doStart(); thread = new Thread(this,getClass().getSimpleName()); thread.setDaemon(true); thread.start(); }
@Override protected void doStop() throws Exception { super.doStop(); thread.interrupt(); }
@Override protected void doStart() throws Exception { _timer = _name == null ? new Timer() : new Timer(_name, _daemon); run(); super.doStart(); }
@Override protected void doStop() throws Exception { _timer.cancel(); super.doStop(); _timer = null; }
@Override public final void start() throws Exception { synchronized (_lock) { try { if (_state == __STARTED || _state == __STARTING) return; setStarting(); doStart(); setStarted(); } catch (Throwable e) { setFailed(e); throw e; } } }
@Override protected void doStart() throws Exception { super.doStart(); items.set(new CopyOnWriteArrayList<Sweepable>()); activate(); }
@Override public final void stop() throws Exception { synchronized (_lock) { try { if (_state == __STOPPING || _state == __STOPPED) return; setStopping(); doStop(); setStopped(); } catch (Throwable e) { setFailed(e); throw e; } } }
@Override protected void doStop() throws Exception { scheduler.shutdownNow(); super.doStop(); scheduler = null; }
out.append(s).append(" - ").append((AbstractLifeCycle.getState((LifeCycle)o))).append("\n"); else out.append(s).append("\n");
@Override public final void start() throws Exception { synchronized (_lock) { try { if (_state == __STARTED || _state == __STARTING) return; setStarting(); doStart(); setStarted(); } catch (Throwable e) { setFailed(e); throw e; } } }
@Override protected void doStart() throws Exception { ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); prevent(getClass().getClassLoader()); super.doStart(); } finally { Thread.currentThread().setContextClassLoader(loader); } } }
@Override public final void stop() throws Exception { synchronized (_lock) { try { if (_state == __STOPPING || _state == __STOPPED) return; setStopping(); doStop(); setStopped(); } catch (Throwable e) { setFailed(e); throw e; } } }
@Override protected void doStop() throws Exception { deactivate(); items.set(null); super.doStop(); }
@Override public void dump(Appendable out, String indent) throws IOException { out.append(toString()) .append(" - ").append(AbstractLifeCycle.getState(this)).append("\n"); }
@Override public final void start() throws Exception { synchronized (_lock) { try { if (_state == __STARTED || _state == __STARTING) return; setStarting(); doStart(); setStarted(); } catch (Throwable e) { setFailed(e); throw e; } } }
@Override protected void doStart() throws Exception { scheduler = new ScheduledThreadPoolExecutor(1, new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread thread = ScheduledExecutorScheduler.this.thread = new Thread(threadGroup, r, name); thread.setDaemon(daemon); thread.setContextClassLoader(classloader); return thread; } }); scheduler.setRemoveOnCancelPolicy(true); super.doStart(); }
@Override public final void stop() throws Exception { synchronized (_lock) { try { if (_state == __STOPPING || _state == __STOPPED) return; setStopping(); doStop(); setStopped(); } catch (Throwable e) { setFailed(e); throw e; } } }