public abstract class AbstractEndpoint extends IntegrationObjectSupport implements org.springframework.context.SmartLifecycle, org.springframework.beans.factory.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 java.util.concurrent.locks.Condition |
lifecycleCondition |
protected java.util.concurrent.locks.ReentrantLock |
lifecycleLock |
EXPRESSION_PARSER, logger
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(java.lang.Runnable callback)
Stop the component and invoke callback.
|
int |
getPhase() |
java.lang.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(java.lang.String role)
Specify the role for the endpoint.
|
void |
setTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler) |
void |
start() |
void |
stop() |
void |
stop(java.lang.Runnable callback) |
afterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, toString
protected final java.util.concurrent.locks.ReentrantLock lifecycleLock
protected final java.util.concurrent.locks.Condition lifecycleCondition
public void setAutoStartup(boolean autoStartup)
public void setPhase(int phase)
public void setRole(java.lang.String role)
role
- the role for this endpoint.SmartLifecycle
,
SmartLifecycleRoleController
public java.lang.String getRole()
public void setTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler)
setTaskScheduler
in class IntegrationObjectSupport
protected void onInit() throws java.lang.Exception
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport
java.lang.Exception
- Any exception.public void destroy() throws java.lang.Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
java.lang.Exception
public final boolean isAutoStartup()
isAutoStartup
in interface org.springframework.context.SmartLifecycle
public final int getPhase()
getPhase
in interface org.springframework.context.Phased
getPhase
in interface org.springframework.context.SmartLifecycle
public final boolean isRunning()
isRunning
in interface org.springframework.context.Lifecycle
public final void start()
start
in interface org.springframework.context.Lifecycle
public final void stop()
stop
in interface org.springframework.context.Lifecycle
public final void stop(java.lang.Runnable callback)
stop
in interface org.springframework.context.SmartLifecycle
protected void doStop(java.lang.Runnable callback)
callback
- the Runnable to invoke.protected abstract void doStart()
lifecycleLock
.protected abstract void doStop()
lifecycleLock
.