Interface AsyncProcessorAwaitManager

  • All Superinterfaces:
    AutoCloseable, Service, StaticService

    public interface AsyncProcessorAwaitManager
    extends StaticService
    A manager to handle async routing engine, when Exchanges are being handed over from one thread to another, while the callee thread is blocked waiting for the other threads to complete, before it can continue.

    This manager offers insight into the state, and allow to force stuck exchanges to be continued and for blocked threads to be unblocked, which may happen in case of severe malfunctions (such as the system runs out of memory, a 3rd party never responding, or a timeout not triggering, etc).

    • Method Detail

      • process

        void process​(AsyncProcessor processor,
                     Exchange exchange)
        Process the given exchange sychronously.
        Parameters:
        processor - the async processor to call
        exchange - the exchange to process
      • size

        int size()
        Number of threads that are blocked waiting for other threads to trigger the callback when they are done processing the exchange.
      • interrupt

        void interrupt​(String exchangeId)
        To interrupt an exchange which may seem as stuck, to force the exchange to continue, allowing any blocking thread to be released.

        Important: Use this with caution as the other thread is still assumed to be process the exchange. Though if it appears as the exchange is stuck, then this method can remedy this, by forcing the latch to count-down so the blocked thread can continue. An exception is set on the exchange which allows Camel's error handler to deal with this malfunctioned exchange.

        Parameters:
        exchangeId - the exchange id to interrupt.
      • interrupt

        void interrupt​(Exchange exchange)
        To interrupt an exchange which may seem as stuck, to force the exchange to continue, allowing any blocking thread to be released.

        Important: Use this with caution as the other thread is still assumed to be process the exchange. Though if it appears as the exchange is stuck, then this method can remedy this, by forcing the latch to count-down so the blocked thread can continue. An exception is set on the exchange which allows Camel's error handler to deal with this malfunctioned exchange.

        Parameters:
        exchange - the exchange to interrupt.
      • isInterruptThreadsWhileStopping

        boolean isInterruptThreadsWhileStopping()
        Whether to interrupt any blocking threads during stopping.

        This is enabled by default which allows Camel to release any blocked thread during shutting down Camel itself.

      • setInterruptThreadsWhileStopping

        void setInterruptThreadsWhileStopping​(boolean interruptThreadsWhileStopping)
        Sets whether to interrupt any blocking threads during stopping.

        This is enabled by default which allows Camel to release any blocked thread during shutting down Camel itself.