Class UimaDefaultMessageListenerContainer
- java.lang.Object
-
- org.springframework.jms.support.JmsAccessor
-
- org.springframework.jms.support.destination.JmsDestinationAccessor
-
- org.springframework.jms.listener.AbstractJmsListeningContainer
-
- org.springframework.jms.listener.AbstractMessageListenerContainer
-
- org.springframework.jms.listener.AbstractPollingMessageListenerContainer
-
- org.springframework.jms.listener.DefaultMessageListenerContainer
-
- org.apache.uima.adapter.jms.activemq.UimaDefaultMessageListenerContainer
-
- All Implemented Interfaces:
javax.jms.ExceptionListener
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.Lifecycle
,org.springframework.context.Phased
,org.springframework.context.SmartLifecycle
,org.springframework.jms.listener.MessageListenerContainer
public class UimaDefaultMessageListenerContainer extends org.springframework.jms.listener.DefaultMessageListenerContainer implements javax.jms.ExceptionListener
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
terminating
-
Fields inherited from class org.springframework.jms.listener.DefaultMessageListenerContainer
CACHE_AUTO, CACHE_CONNECTION, CACHE_CONSUMER, CACHE_NONE, CACHE_SESSION, DEFAULT_RECOVERY_INTERVAL, DEFAULT_THREAD_NAME_PREFIX
-
Fields inherited from class org.springframework.jms.listener.AbstractPollingMessageListenerContainer
DEFAULT_RECEIVE_TIMEOUT
-
Fields inherited from class org.springframework.jms.listener.AbstractJmsListeningContainer
lifecycleMonitor, sharedConnectionMonitor
-
-
Constructor Summary
Constructors Constructor Description UimaDefaultMessageListenerContainer()
UimaDefaultMessageListenerContainer(boolean freeCasQueueListener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
void
afterPropertiesSet(boolean propagate)
Called by Spring and some Uima AS components when all properties have been set.void
closeConnection()
Closes shares connection to a brokervoid
delegateStop()
void
destroy()
Spins a shutdown thread and stops Sprint and ActiveMQ threads.void
doDestroy()
Delegate shutdown to the super classjava.lang.String
getBrokerUrl()
java.lang.String
getDestinationName()
java.lang.String
getEndpointName()
javax.jms.Destination
getListenerEndpoint()
org.springframework.core.task.TaskExecutor
getTaskExecutor()
protected void
handleListenerException(java.lang.Throwable t)
protected void
handleListenerSetupFailure(java.lang.Throwable t, boolean alreadyHandled)
This method is called by Spring when a listener failsvoid
initializeContainer()
boolean
isFreeCasQueueListener()
void
onException(javax.jms.JMSException arg0)
protected void
recoverAfterListenerSetupFailure()
protected void
refreshConnectionUntilSuccessful()
Overriden Spring's method that tries to recover from lost connection.void
setConcurrentConsumers(int concurrentConsumers)
Intercept Spring call to increment number of consumer threads.void
setConnectionFactory(javax.jms.ConnectionFactory aConnectionFactory)
void
setController(AnalysisEngineController aController)
void
setDestination(javax.jms.Destination aDestination)
void
setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver resolver)
void
setMessageListener(java.lang.Object messageListener)
Intercept Spring call to inject application Pojo listener.void
setMessageSelector(java.lang.String messageSelector)
protected void
setModifiedTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
void
setTargetEndpoint(Endpoint anEndpoint)
void
setTaskExecutor(org.springframework.core.task.TaskExecutor aTaskExecutor)
Called by Spring to inject TaskExecutorvoid
setTerminating()
void
shutdownTaskExecutor(java.util.concurrent.ThreadPoolExecutor tpe)
void
stop()
-
Methods inherited from class org.springframework.jms.listener.DefaultMessageListenerContainer
applyBackOffTime, createDefaultTaskExecutor, doInitialize, doRescheduleTask, doShutdown, establishSharedConnection, getActiveConsumerCount, getCacheLevel, getConcurrentConsumers, getIdleConsumerLimit, getIdleTaskExecutionLimit, getMaxConcurrentConsumers, getMaxMessagesPerTask, getScheduledConsumerCount, initialize, isRecovering, isRegisteredWithDestination, messageReceived, noMessageReceived, refreshDestination, scheduleNewInvokerIfAppropriate, setBackOff, setCacheLevel, setCacheLevelName, setConcurrency, setIdleConsumerLimit, setIdleTaskExecutionLimit, setMaxConcurrentConsumers, setMaxMessagesPerTask, setRecoveryInterval, setTaskExecutor, sharedConnectionEnabled, start, startSharedConnection, stop, stopSharedConnection
-
Methods inherited from class org.springframework.jms.listener.AbstractPollingMessageListenerContainer
createListenerConsumer, doReceiveAndExecute, getConnection, getReceiveTimeout, getSession, getTransactionManager, isSessionLocallyTransacted, receiveAndExecute, receiveMessage, setReceiveTimeout, setSessionTransacted, setTransactionManager, setTransactionName, setTransactionTimeout, shouldCommitAfterNoMessageReceived
-
Methods inherited from class org.springframework.jms.listener.AbstractMessageListenerContainer
checkMessageListener, commitIfNecessary, createConsumer, doExecuteListener, doInvokeListener, doInvokeListener, executeListener, getDefaultSubscriptionName, getDestination, getDestinationDescription, getDurableSubscriptionName, getErrorHandler, getExceptionListener, getMessageConverter, getMessageListener, getMessageSelector, getSubscriptionName, invokeErrorHandler, invokeExceptionListener, invokeListener, isAcceptMessagesWhileStopping, isExposeListenerSession, isPubSubNoLocal, isReplyPubSubDomain, isSubscriptionDurable, isSubscriptionShared, rollbackIfNecessary, rollbackOnExceptionIfNecessary, setAcceptMessagesWhileStopping, setDestinationName, setDurableSubscriptionName, setErrorHandler, setExceptionListener, setExposeListenerSession, setMessageConverter, setPubSubNoLocal, setReplyPubSubDomain, setSubscriptionDurable, setSubscriptionName, setSubscriptionShared, setupMessageListener, validateConfiguration
-
Methods inherited from class org.springframework.jms.listener.AbstractJmsListeningContainer
createSharedConnection, doStart, doStop, getBeanName, getClientId, getPausedTaskCount, getPhase, getSharedConnection, isActive, isAutoStartup, isRunning, logRejectedTask, prepareSharedConnection, refreshSharedConnection, rescheduleTaskIfNecessary, resumePausedTasks, runningAllowed, setAutoStartup, setBeanName, setClientId, setPhase, shutdown
-
Methods inherited from class org.springframework.jms.support.destination.JmsDestinationAccessor
getDestinationResolver, isPubSubDomain, receiveFromConsumer, resolveDestinationName, setPubSubDomain
-
Methods inherited from class org.springframework.jms.support.JmsAccessor
convertJmsAccessException, createConnection, createSession, getConnectionFactory, getSessionAcknowledgeMode, isClientAcknowledge, isSessionTransacted, setSessionAcknowledgeMode, setSessionAcknowledgeModeName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
refreshConnectionUntilSuccessful
protected void refreshConnectionUntilSuccessful()
Overriden Spring's method that tries to recover from lost connection. We dont want to recover when the service is stopping.- Overrides:
refreshConnectionUntilSuccessful
in classorg.springframework.jms.listener.DefaultMessageListenerContainer
-
recoverAfterListenerSetupFailure
protected void recoverAfterListenerSetupFailure()
- Overrides:
recoverAfterListenerSetupFailure
in classorg.springframework.jms.listener.DefaultMessageListenerContainer
-
setTerminating
public void setTerminating()
-
setController
public void setController(AnalysisEngineController aController)
-
handleListenerSetupFailure
protected void handleListenerSetupFailure(java.lang.Throwable t, boolean alreadyHandled)
This method is called by Spring when a listener fails- Overrides:
handleListenerSetupFailure
in classorg.springframework.jms.listener.DefaultMessageListenerContainer
-
handleListenerException
protected void handleListenerException(java.lang.Throwable t)
- Overrides:
handleListenerException
in classorg.springframework.jms.listener.AbstractMessageListenerContainer
-
initializeContainer
public void initializeContainer()
-
setConcurrentConsumers
public void setConcurrentConsumers(int concurrentConsumers)
Intercept Spring call to increment number of consumer threads. If the value > 1, don't propagate to Spring. A new listener will be injected and it will use provided number of consumer threads.- Overrides:
setConcurrentConsumers
in classorg.springframework.jms.listener.DefaultMessageListenerContainer
-
setMessageListener
public void setMessageListener(java.lang.Object messageListener)
Intercept Spring call to inject application Pojo listener. Don't propagate the listener up to Spring just yet. If more than one consumer thread is used, a different listener will be injected.- Overrides:
setMessageListener
in classorg.springframework.jms.listener.AbstractMessageListenerContainer
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Overrides:
afterPropertiesSet
in classorg.springframework.jms.listener.AbstractJmsListeningContainer
-
afterPropertiesSet
public void afterPropertiesSet(boolean propagate)
Called by Spring and some Uima AS components when all properties have been set. This method spins a thread in which the listener is initialized.
-
getDestinationName
public java.lang.String getDestinationName()
- Overrides:
getDestinationName
in classorg.springframework.jms.listener.AbstractMessageListenerContainer
-
getEndpointName
public java.lang.String getEndpointName()
-
getBrokerUrl
public java.lang.String getBrokerUrl()
-
setConnectionFactory
public void setConnectionFactory(javax.jms.ConnectionFactory aConnectionFactory)
- Overrides:
setConnectionFactory
in classorg.springframework.jms.support.JmsAccessor
-
setDestinationResolver
public void setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver resolver)
- Overrides:
setDestinationResolver
in classorg.springframework.jms.support.destination.JmsDestinationAccessor
-
closeConnection
public void closeConnection() throws java.lang.Exception
Closes shares connection to a broker- Throws:
java.lang.Exception
-
setDestination
public void setDestination(javax.jms.Destination aDestination)
- Overrides:
setDestination
in classorg.springframework.jms.listener.AbstractMessageListenerContainer
-
getListenerEndpoint
public javax.jms.Destination getListenerEndpoint()
-
onException
public void onException(javax.jms.JMSException arg0)
- Specified by:
onException
in interfacejavax.jms.ExceptionListener
-
setTargetEndpoint
public void setTargetEndpoint(Endpoint anEndpoint)
-
isFreeCasQueueListener
public boolean isFreeCasQueueListener()
-
setModifiedTaskExecutor
protected void setModifiedTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
-
doDestroy
public void doDestroy()
Delegate shutdown to the super class
-
setMessageSelector
public void setMessageSelector(java.lang.String messageSelector)
- Overrides:
setMessageSelector
in classorg.springframework.jms.listener.AbstractMessageListenerContainer
-
shutdownTaskExecutor
public void shutdownTaskExecutor(java.util.concurrent.ThreadPoolExecutor tpe) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
destroy
public void destroy()
Spins a shutdown thread and stops Sprint and ActiveMQ threads.- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Overrides:
destroy
in classorg.springframework.jms.listener.AbstractJmsListeningContainer
-
setTaskExecutor
public void setTaskExecutor(org.springframework.core.task.TaskExecutor aTaskExecutor)
Called by Spring to inject TaskExecutor
-
getTaskExecutor
public org.springframework.core.task.TaskExecutor getTaskExecutor()
-
delegateStop
public void delegateStop()
-
stop
public void stop() throws org.springframework.jms.JmsException
- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
- Overrides:
stop
in classorg.springframework.jms.listener.AbstractJmsListeningContainer
- Throws:
org.springframework.jms.JmsException
-
-