Camel
  1. Camel
  2. CAMEL-7240

ThreadsProcessor should resolve RejectedPolicy from the referenced ThreadPoolProfile

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.13.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      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.

        Activity

        Hide
        Henryk Konsek added a comment -

        Fixed in 77bbb6e2783cb552fb735ce6caeb711bec8eb472.

        Show
        Henryk Konsek added a comment - Fixed in 77bbb6e2783cb552fb735ce6caeb711bec8eb472.

          People

          • Assignee:
            Unassigned
            Reporter:
            Henryk Konsek
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development