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
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.jms.listener.AbstractJmsListeningContainer

    org.springframework.jms.listener.AbstractJmsListeningContainer.SharedConnectionNotInitializedException
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static boolean
     

    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

    Fields inherited from class org.springframework.jms.support.destination.JmsDestinationAccessor

    RECEIVE_TIMEOUT_INDEFINITE_WAIT, RECEIVE_TIMEOUT_NO_WAIT

    Fields inherited from class org.springframework.jms.support.JmsAccessor

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    UimaDefaultMessageListenerContainer(boolean freeCasQueueListener)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    afterPropertiesSet(boolean propagate)
    Called by Spring and some Uima AS components when all properties have been set.
    void
    Closes shares connection to a broker
    void
     
    void
    Spins a shutdown thread and stops Sprint and ActiveMQ threads.
    void
    Delegate shutdown to the super class
     
     
     
    javax.jms.Destination
     
    org.springframework.core.task.TaskExecutor
     
    protected void
     
    protected void
    handleListenerSetupFailure(Throwable t, boolean alreadyHandled)
    This method is called by Spring when a listener fails
    void
     
    boolean
     
    void
    onException(javax.jms.JMSException arg0)
     
    protected void
     
    protected void
    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
     
    void
    setDestination(javax.jms.Destination aDestination)
     
    void
    setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver resolver)
     
    void
    setMessageListener(Object messageListener)
    Intercept Spring call to inject application Pojo listener.
    void
    setMessageSelector(String messageSelector)
     
    protected void
    setModifiedTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
     
    void
     
    void
    setTaskExecutor(org.springframework.core.task.TaskExecutor aTaskExecutor)
    Called by Spring to inject TaskExecutor
    void
     
    void
     
    void
     

    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

    Methods inherited from interface org.springframework.context.Lifecycle

    isRunning

    Methods inherited from interface org.springframework.jms.listener.MessageListenerContainer

    getDestinationResolver, isPubSubDomain

    Methods inherited from interface org.springframework.context.Phased

    getPhase

    Methods inherited from interface org.springframework.context.SmartLifecycle

    isAutoStartup
  • Field Details

    • terminating

      public static volatile boolean terminating
  • Constructor Details

    • UimaDefaultMessageListenerContainer

      public UimaDefaultMessageListenerContainer()
    • UimaDefaultMessageListenerContainer

      public UimaDefaultMessageListenerContainer(boolean freeCasQueueListener)
  • Method Details

    • 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 class org.springframework.jms.listener.DefaultMessageListenerContainer
    • recoverAfterListenerSetupFailure

      protected void recoverAfterListenerSetupFailure()
      Overrides:
      recoverAfterListenerSetupFailure in class org.springframework.jms.listener.DefaultMessageListenerContainer
    • setTerminating

      public void setTerminating()
    • setController

      public void setController(AnalysisEngineController aController)
    • handleListenerSetupFailure

      protected void handleListenerSetupFailure(Throwable t, boolean alreadyHandled)
      This method is called by Spring when a listener fails
      Overrides:
      handleListenerSetupFailure in class org.springframework.jms.listener.DefaultMessageListenerContainer
    • handleListenerException

      protected void handleListenerException(Throwable t)
      Overrides:
      handleListenerException in class org.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 class org.springframework.jms.listener.DefaultMessageListenerContainer
    • setMessageListener

      public void setMessageListener(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 class org.springframework.jms.listener.AbstractMessageListenerContainer
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Overrides:
      afterPropertiesSet in class org.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 String getDestinationName()
      Overrides:
      getDestinationName in class org.springframework.jms.listener.AbstractMessageListenerContainer
    • getEndpointName

      public String getEndpointName()
    • getBrokerUrl

      public String getBrokerUrl()
    • setConnectionFactory

      public void setConnectionFactory(javax.jms.ConnectionFactory aConnectionFactory)
      Overrides:
      setConnectionFactory in class org.springframework.jms.support.JmsAccessor
    • setDestinationResolver

      public void setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver resolver)
      Overrides:
      setDestinationResolver in class org.springframework.jms.support.destination.JmsDestinationAccessor
    • closeConnection

      public void closeConnection() throws Exception
      Closes shares connection to a broker
      Throws:
      Exception
    • setDestination

      public void setDestination(javax.jms.Destination aDestination)
      Overrides:
      setDestination in class org.springframework.jms.listener.AbstractMessageListenerContainer
    • getListenerEndpoint

      public javax.jms.Destination getListenerEndpoint()
    • onException

      public void onException(javax.jms.JMSException arg0)
      Specified by:
      onException in interface javax.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(String messageSelector)
      Overrides:
      setMessageSelector in class org.springframework.jms.listener.AbstractMessageListenerContainer
    • shutdownTaskExecutor

      public void shutdownTaskExecutor(ThreadPoolExecutor tpe) throws InterruptedException
      Throws:
      InterruptedException
    • destroy

      public void destroy()
      Spins a shutdown thread and stops Sprint and ActiveMQ threads.
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Overrides:
      destroy in class org.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 interface org.springframework.context.Lifecycle
      Overrides:
      stop in class org.springframework.jms.listener.AbstractJmsListeningContainer
      Throws:
      org.springframework.jms.JmsException