@Override protected void start() { super.start(); if (delegate instanceof LifecycleAware) { try { ((LifecycleAware) delegate).onStart(); } catch (final Throwable ex) { exceptionHandler.handleOnStartException(ex); } } }
@Override protected void shutdown() { super.shutdown(); if (delegate instanceof LifecycleAware) { try { ((LifecycleAware) delegate).onShutdown(); } catch (final Throwable ex) { exceptionHandler.handleOnShutdownException(ex); } } }
@Override public synchronized void onStart() { if (!started) { if (delegate instanceof LifecycleAware) { ((LifecycleAware) delegate).onStart(); } started = true; } }
@Override public synchronized void onShutdown() { if (started) { started = false; if (delegate instanceof LifecycleAware) { ((LifecycleAware) delegate).onShutdown(); } } }
private void notifyStart() { if (eventHandler instanceof LifecycleAware) { try { ((LifecycleAware) eventHandler).onStart(); } catch (final Throwable ex) { exceptionHandler.handleOnStartException(ex); } } }
private void notifyShutdown() { if (eventHandler instanceof LifecycleAware) { try { ((LifecycleAware) eventHandler).onShutdown(); } catch (final Throwable ex) { exceptionHandler.handleOnShutdownException(ex); } } }
private AccessorEventHandler(EventHandler<T> handler) { this.handler = handler; lifecycle = handler instanceof LifecycleAware ? (LifecycleAware) handler : null; }