Class AbstractEndpoint
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle,ExpressionCapable,NamedComponent,ManageableLifecycle,ManageableSmartLifecycle
- Direct Known Subclasses:
AbstractPollingEndpoint,EventDrivenConsumer,GatewayProxyFactoryBean,MessageProducerSupport,MessagingGatewaySupport,ReactiveStreamsConsumer
@IntegrationManagedResource public abstract class AbstractEndpoint extends IntegrationObjectSupport implements ManageableSmartLifecycle, org.springframework.beans.factory.DisposableBean
The base class for Message Endpoint implementations.
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.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.locks.ConditionlifecycleConditionprotected java.util.concurrent.locks.ReentrantLocklifecycleLockFields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger -
Constructor Summary
Constructors Constructor Description AbstractEndpoint() -
Method Summary
Modifier and Type Method Description voiddestroy()protected abstract voiddoStart()Subclasses must implement this method with the start behavior.protected abstract voiddoStop()Subclasses must implement this method with the stop behavior.protected voiddoStop(java.lang.Runnable callback)Stop the component and invoke callback.intgetPhase()java.lang.StringgetRole()booleanisActive()booleanisAutoStartup()booleanisRunning()protected voidonInit()Subclasses may implement this for initialization logic.voidsetAutoStartup(boolean autoStartup)voidsetPhase(int phase)voidsetRole(java.lang.String role)Specify the role for the endpoint.voidstart()voidstop()voidstop(java.lang.Runnable callback)Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
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
-
Field Details
-
lifecycleLock
protected final java.util.concurrent.locks.ReentrantLock lifecycleLock -
lifecycleCondition
protected final java.util.concurrent.locks.Condition lifecycleCondition
-
-
Constructor Details
-
AbstractEndpoint
public AbstractEndpoint()
-
-
Method Details
-
setAutoStartup
public void setAutoStartup(boolean autoStartup) -
setPhase
public void setPhase(int phase) -
setRole
public void setRole(java.lang.String role)Specify the role for the endpoint. Such endpoints can be started/stopped as a group.- Parameters:
role- the role for this endpoint.- Since:
- 5.0
- See Also:
SmartLifecycle,SmartLifecycleRoleController
-
getRole
public java.lang.String getRole() -
onInit
protected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
onInitin classIntegrationObjectSupport
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
isAutoStartup
public final boolean isAutoStartup()- Specified by:
isAutoStartupin interfaceorg.springframework.context.SmartLifecycle
-
getPhase
public final int getPhase()- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-
isRunning
public final boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle- Specified by:
isRunningin interfaceManageableLifecycle
-
start
public final void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle- Specified by:
startin interfaceManageableLifecycle
-
stop
public final void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle- Specified by:
stopin interfaceManageableLifecycle
-
stop
public final void stop(java.lang.Runnable callback)- Specified by:
stopin interfaceorg.springframework.context.SmartLifecycle
-
doStop
protected void doStop(java.lang.Runnable callback)Stop the component and invoke callback.- Parameters:
callback- the Runnable to invoke.
-
isActive
public boolean isActive() -
doStart
protected abstract void doStart()Subclasses must implement this method with the start behavior. This method will be invoked while holding thelifecycleLock. -
doStop
protected abstract void doStop()Subclasses must implement this method with the stop behavior. This method will be invoked while holding thelifecycleLock.
-