LifeCycle.Status| Modifier and Type | Field and Description |
|---|---|
protected List<LifeCycle> |
dependencies |
protected AtomicReference<Exception> |
exception |
protected ExecutorService |
executorService |
protected Logger |
logger |
protected LifeCycle.Status |
status |
protected Object |
statusLock |
| Constructor and Description |
|---|
BaseLifeCycle(ExecutorService executor,
LifeCycle... dependencies) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDependency(LifeCycle lifeCycle) |
protected void |
awaitShutdown(long timeout) |
protected void |
awaitStatus(LifeCycle.Status intended,
long timeout) |
protected abstract void |
doShutdown() |
protected abstract void |
doWork() |
protected void |
exceptionIfDepedenciesNotActive() |
protected void |
exceptionIfNotActive() |
Exception |
getException() |
protected Exception |
getExceptionFromDependenciesOrNull() |
LifeCycle.Status |
getStatus() |
void |
run() |
protected boolean |
shouldDoWork() |
void |
shutdown()
Requests shutdown of the component.
|
void |
shutdown(long waitMs)
Requests shutdown, but will only wait @link waitms milliseconds
|
void |
start()
Asynchronously starts the component
|
protected Logger logger
protected final ExecutorService executorService
protected final Object statusLock
protected volatile LifeCycle.Status status
protected AtomicReference<Exception> exception
public BaseLifeCycle(ExecutorService executor, LifeCycle... dependencies)
public void addDependency(LifeCycle lifeCycle)
public LifeCycle.Status getStatus()
protected abstract void doShutdown()
protected boolean shouldDoWork()
@PostConstruct public void start()
LifeCycleprotected void exceptionIfDepedenciesNotActive()
protected Exception getExceptionFromDependenciesOrNull()
public Exception getException()
getException in interface LifeCycleprotected void awaitShutdown(long timeout)
throws InterruptedException
InterruptedExceptionprotected void awaitStatus(LifeCycle.Status intended, long timeout) throws InterruptedException
InterruptedException@PreDestroy public void shutdown()
LifeCyclepublic void shutdown(long waitMs)
LifeCycleprotected void exceptionIfNotActive()
Copyright © 2009-2012 jclouds. All Rights Reserved.