@IntegrationManagedResource public abstract class AbstractEndpoint extends IntegrationObjectSupport implements ManageableSmartLifecycle, DisposableBean
This class implements Lifecycle and provides an autoStartup
property. If true
, the endpoint will start automatically upon
initialization. Otherwise, it will require an explicit invocation of its
start()
method. The default value is true
.
To require explicit startup, provide a value of false
to the setAutoStartup(boolean)
method.
Modifier and Type | Field and Description |
---|---|
protected Condition |
lifecycleCondition |
protected ReentrantLock |
lifecycleLock |
EXPRESSION_PARSER, logger
DEFAULT_PHASE
Constructor and Description |
---|
AbstractEndpoint() |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
protected abstract void |
doStart()
Subclasses must implement this method with the start behavior.
|
protected abstract void |
doStop()
Subclasses must implement this method with the stop behavior.
|
protected void |
doStop(Runnable callback)
Stop the component and invoke callback.
|
int |
getPhase() |
String |
getRole() |
boolean |
isAutoStartup() |
boolean |
isRunning() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
void |
setAutoStartup(boolean autoStartup) |
void |
setPhase(int phase) |
void |
setRole(String role)
Specify the role for the endpoint.
|
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
protected final ReentrantLock lifecycleLock
protected final Condition lifecycleCondition
public void setAutoStartup(boolean autoStartup)
public void setPhase(int phase)
public void setRole(String role)
role
- the role for this endpoint.SmartLifecycle
,
SmartLifecycleRoleController
public String getRole()
protected void onInit()
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport
public void destroy()
destroy
in interface DisposableBean
public final boolean isAutoStartup()
isAutoStartup
in interface SmartLifecycle
public final int getPhase()
getPhase
in interface Phased
getPhase
in interface SmartLifecycle
public final boolean isRunning()
isRunning
in interface Lifecycle
isRunning
in interface ManageableLifecycle
public final void start()
start
in interface Lifecycle
start
in interface ManageableLifecycle
public final void stop()
stop
in interface Lifecycle
stop
in interface ManageableLifecycle
public final void stop(Runnable callback)
stop
in interface SmartLifecycle
protected void doStop(Runnable callback)
callback
- the Runnable to invoke.protected abstract void doStart()
lifecycleLock
.protected abstract void doStop()
lifecycleLock
.