Package org.apache.camel.spi
Interface AsyncProcessorAwaitManager
-
- All Superinterfaces:
AutoCloseable
,Service
,StaticService
public interface AsyncProcessorAwaitManager extends StaticService
A manager to handle async routing engine, whenExchange
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
Nested Classes Modifier and Type Interface Description static interface
AsyncProcessorAwaitManager.AwaitThread
Information about the thread and exchange that are inflight.static interface
AsyncProcessorAwaitManager.Statistics
Utilization statistics of this manager.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Collection<AsyncProcessorAwaitManager.AwaitThread>
browse()
A read-only browser of theAsyncProcessorAwaitManager.AwaitThread
s that are currently inflight.AsyncProcessorAwaitManager.Statistics
getStatistics()
Gets the utilization statistics of this managervoid
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.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.boolean
isInterruptThreadsWhileStopping()
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 Detail
-
process
void process(AsyncProcessor processor, Exchange exchange)
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
Collection<AsyncProcessorAwaitManager.AwaitThread> browse()
A read-only browser of theAsyncProcessorAwaitManager.AwaitThread
s that are currently inflight.
-
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.
-
getStatistics
AsyncProcessorAwaitManager.Statistics getStatistics()
Gets the utilization statistics of this manager- Returns:
- the utilization statistics
-
-