Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16848

Remove The creation of executorService in JMSConsumer

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Information Provided
    • 2.25.4
    • None
    • camel-jms
    • Camel 2.23.4

      Centos 7

    • Unknown

    Description

      In JMSConsumer,we have an executorService that's created but used only when shutting down and stopping the ListenerContainer.

       

      protected void stopAndDestroyListenerContainer() {
       if (listenerContainer != null) {
       try {
       listenerContainer.stop();
       listenerContainer.destroy();
       } finally {
       getEndpoint().onListenerContainerStopped(listenerContainer);
       }
       }
       // null container and listener so they are fully re created if this consumer is restarted
       // then we will use updated configuration from jms endpoint that may have been managed using JMX
       listenerContainer = null;
       messageListener = null;
       initialized = false;
      // shutdown thread pool if listener container was using a private thread pool
       if (shutdownExecutorService && executorService != null) {
       getEndpoint().getCamelContext().getExecutorServiceManager().shutdownNow(executorService);
       }
       executorService = null;
       }
      

       

      As per git history,this was created to fix the issue https://issues.apache.org/jira/browse/CAMEL-6199

       

      But for our case we are not adding or removing routes dynamiclly and what we have remarked is that for each JMS_CONSUMER ,we are creating a newCashedThreadPool for no reason:

       

      else if ((listenerContainer instanceof DefaultJmsMessageListenerContainer && configuration.getDefaultTaskExecutorType() == null)
       || !(listenerContainer instanceof DefaultJmsMessageListenerContainer)) {
       // preserve backwards compatibility if an explicit Default TaskExecutor Type was not set;
       // otherwise, defer the creation of the TaskExecutor
       // use a cached pool as DefaultMessageListenerContainer will throttle pool sizing
       ExecutorService executor = getCamelContext().getExecutorServiceManager().newCachedThreadPool(consumer, consumerName);
       setContainerTaskExecutor(listenerContainer, executor);
       // we created a new private thread pool that this listener container is using, now store a reference on the consumer
       // so when the consumer is stopped we can shutdown the thread pool also, to ensure all resources is shutdown
       consumer.setListenerContainerExecutorService(executor, true);

       

      This threadPoolExecutor that is passed to the JMS_CONSUMER is making a performance impact in our application .

      Can we remove it and /or make it configurable so we can desactive it ?

       

      Thanks.

       

      Nizar

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              nizar.ben.mansour@gmail.com nizar.ben.mansour
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: