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

ThreadsProcessor should resolve RejectedPolicy from the referenced ThreadPoolProfile

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.13.0
    • camel-core
    • None
    • Unknown

    Description

      Hi,

      ThreadsProcessor uses rejectedPolicy field to determine if it should set the exception on the exchange.

      boolean abort = ThreadPoolRejectedPolicy.Abort == rejectedPolicy;
      if (abort) {
        exchange.setException(new RejectedExecutionException());
      }
      

      Unfortunately ThreadsDefinition reads rejectedPolicy only if the latter is set directly on the Threads definition level. If getExecutorServiceRef is set on the ThreadsDefinition, the rejectedPolicy value from the referenced thread pool profile is ignored.

      ThreadsProcessor thread = ...;
      ...
      thread.setRejectedPolicy(getRejectedPolicy());
      

      That leads to the situations when task is rejected, but exception is not set on the exchange, because ThreadsProcessor is unaware of the effective rejection policy.

      The following configuration demonstrates the issue:

      <threadPool id="bigPool" poolSize="1" maxPoolSize="1" threadName="foo" maxQueueSize="1" rejectedPolicy="Abort"/>
      ...
      <threads executorServiceRef="bigPool" ...>
      ...
      

      ThreadsProcessor should resolve the rejection policy from the thread pool profile if one is referenced with the ExecutorServiceRef option.

      Attachments

        Activity

          People

            Unassigned Unassigned
            hekonsek Henryk Konsek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: