Package org.apache.camel.spi
Interface AsyncProcessorAwaitManager
- All Superinterfaces:
AutoCloseable
,Service
,StaticService
A manager to handle async routing engine, when
Exchange
s 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).-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Information about the thread and exchange that are inflight.static interface
Utilization statistics of this manager. -
Method Summary
Modifier and TypeMethodDescriptionbrowse()
A read-only browser of theAsyncProcessorAwaitManager.AwaitThread
s that are currently inflight.Gets the utilization statistics of this managervoid
To interrupt an exchange which may seem as stuck, to force the exchange to continue, allowing any blocking thread to be released.void
To interrupt an exchange which may seem as stuck, to force the exchange to continue, allowing any blocking thread to be released.boolean
Whether to interrupt any blocking threads during stopping.void
process
(AsyncProcessor processor, Exchange exchange) Process the given exchange synchronously.void
setInterruptThreadsWhileStopping
(boolean interruptThreadsWhileStopping) Sets whether to interrupt any blocking threads during stopping.int
size()
Number of threads that are blocked waiting for other threads to trigger the callback when they are done processing the exchange.
-
Method Details
-
process
Process the given exchange synchronously.- Parameters:
processor
- the async processor to callexchange
- 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. -
browse
A read-only browser of theAsyncProcessorAwaitManager.AwaitThread
s that are currently inflight. -
interrupt
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
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. -
getStatistics
AsyncProcessorAwaitManager.Statistics getStatistics()Gets the utilization statistics of this manager- Returns:
- the utilization statistics
-