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 |
exceptionIfDependenciesNotActive() |
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()
LifeCycle
protected void exceptionIfDependenciesNotActive()
protected Exception getExceptionFromDependenciesOrNull()
public Exception getException()
getException
in interface LifeCycle
protected void awaitShutdown(long timeout) throws InterruptedException
InterruptedException
protected void awaitStatus(LifeCycle.Status intended, long timeout) throws InterruptedException
InterruptedException
@PreDestroy public void shutdown()
LifeCycle
public void shutdown(long waitMs)
LifeCycle
protected void exceptionIfNotActive()
Copyright © 2009-2013 jclouds. All Rights Reserved.