Class CompositeExecutor

java.lang.Object
org.springframework.integration.util.CompositeExecutor
All Implemented Interfaces:
java.util.concurrent.Executor

public class CompositeExecutor
extends java.lang.Object
implements java.util.concurrent.Executor
An Executor that encapsulates two underlying executors. Used in cases where two distinct operation types are being used where sharing threads could adversely affect the operation of the system. For example, NIO event processing threads being used for other blocking operations (such as assembling messages). If a CallerRunsPolicy rejected execution policy is used, the NIO event thread might deadlock, and stop processing events.

In order to work in such an environment, the secondary executor must not have a CallerRunsPolicy rejected execution policy.

It is generally recommended to use a CallerBlocksPolicy on both executors.

Since:
3.0.3
  • Constructor Summary

    Constructors 
    Constructor Description
    CompositeExecutor​(java.util.concurrent.Executor primaryTaskExecutor, java.util.concurrent.Executor secondaryTaskExecutor)  
  • Method Summary

    Modifier and Type Method Description
    void execute​(java.lang.Runnable task)
    Execute using the primary executor.
    void execute2​(java.lang.Runnable task)
    Execute using the secondary executor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CompositeExecutor

      public CompositeExecutor​(java.util.concurrent.Executor primaryTaskExecutor, java.util.concurrent.Executor secondaryTaskExecutor)
  • Method Details

    • execute

      public void execute​(java.lang.Runnable task)
      Execute using the primary executor.
      Specified by:
      execute in interface java.util.concurrent.Executor
      Parameters:
      task - the task to run.
    • execute2

      public void execute2​(java.lang.Runnable task)
      Execute using the secondary executor.
      Parameters:
      task - the task to run.