public void add(final Lifecycle... components) { checkNotNull(components); for (Lifecycle component : components) { add(component); } }
public void remove(final Lifecycle... components) { checkNotNull(components); for (Lifecycle component : components) { remove(component); } }
/** * Stop all managed components. * * Stop order is reverse of start order. * * @throws MultipleFailuresException */ @Override protected void doStop() throws Exception { int count = components.size(); log.debug("Stopping {} components", count); MultipleFailures failures = new MultipleFailures(count); for (Lifecycle component : Lists.reverse(components)) { try { component.stop(); } catch (Throwable failure) { logTransitionFailure("Failed to stop component: " + component, failure); failures.add(failure); } } failures.maybePropagate("Failed to stop " + failures.size() + " components"); } }
/** * Start all managed components. * * Components are started in the order added. * * @throws MultipleFailuresException */ @Override protected void doStart() throws Exception { int count = components.size(); log.debug("Starting {} components", count); MultipleFailures failures = new MultipleFailures(count); for (Lifecycle component : components) { try { component.start(); } catch (Throwable failure) { logTransitionFailure("Failed to start component: " + component, failure); failures.add(failure); } } failures.maybePropagate("Failed to start " + failures.size() + " components"); }
public void add(final LifecycleAware... components) { checkNotNull(components); for (LifecycleAware component : components) { add(component.getLifecycle()); } }
public void remove(final LifecycleAware... components) { checkNotNull(components); for (LifecycleAware component : components) { remove(component.getLifecycle()); } }