Common base class for all containers which need to implement listening
based on a JMS Connection (either shared or freshly obtained for each attempt).
Inherits basic Connection and Session configuration handling from the
JmsAccessor base class.
This class provides basic lifecycle management, in particular management
of a shared JMS Connection. Subclasses are supposed to plug into this
lifecycle, implementing the sharedConnectionEnabled() as well
as the doInitialize() and doShutdown() template methods.
This base class does not assume any specific listener programming model
or listener invoker mechanism. It just provides the general runtime
lifecycle management needed for any kind of JMS-based listening mechanism
that operates on a JMS Connection/Session.
protected final java.lang.Object sharedConnectionMonitor
protected final java.lang.Object lifecycleMonitor
public void setClientId(@Nullable
Specify the JMS client ID for a shared Connection created and used
by this container.
Note that client IDs need to be unique among all active Connections
of the underlying JMS provider. Furthermore, a client ID can only be
assigned if the original ConnectionFactory hasn't already assigned one.
Specify the phase in which this container should be started and
stopped. The startup order proceeds from lowest to highest, and
the shutdown order is the reverse of that. By default this value
is Integer.MAX_VALUE meaning that this container starts as late
as possible and stops as soon as possible.
public int getPhase()
Return the phase in which this container will be started and stopped.
beanName - the name of the bean in the factory.
Note that this name is the actual bean name used in the factory, which may
differ from the originally specified name: in particular for inner bean
names, the actual bean name might have been made unique through appending
"#..." suffixes. Use the BeanFactoryUtils.originalBeanName(String)
method to extract the original bean name (without suffix), if desired.
protected final java.lang.String getBeanName()
Return the bean name that this listener container has been assigned
in its containing bean factory, if any.
Check whether this container's listeners are generally allowed to run.
This implementation always returns true; the default 'running'
state is purely determined by start() / stop().
Subclasses may override this method to check against temporary
conditions that prevent listeners from actually running. In other words,
they may apply further restrictions to the 'running' state, returning
false if such a restriction prevents listeners from running.
The default implementation delegates to createSharedConnection(),
which does one immediate attempt and throws an exception if it fails.
Can be overridden to have a recovery process in place, retrying
until a Connection can be successfully established.