Claus Ibsen created CAMEL-24979:
-----------------------------------
Summary: camel-core - Deprecate exchange pooling
Key: CAMEL-24979
URL: https://issues.apache.org/jira/browse/CAMEL-24979
Project: Camel
Issue Type: Task
Components: camel-core
Reporter: Claus Ibsen
Mark exchange pooling as deprecated (to be removed in a future release).
Exchange pooling (CAMEL-16222) and the pooled internal routing tasks
(CAMEL-16279) were added in Camel 3.9 (2021) to reduce object allocations. The
feature has always been opt-in ({{camel.main.exchange-factory = pooled}}), and
the default is prototype.
*Why deprecate*
* It is complicated. Recycling an exchange is only safe if nothing keeps a
reference to it after it is done, but aggregation strategies, async callbacks,
onCompletion, wire tap and SEDA queues can all hold on to exchanges. Lifecycle
bugs still turn up years later, for example CAMEL-23686 (clock reset on the
wrong exchange in PooledProcessorExchangeFactory).
* It is legacy on a modern JVM. Short-lived small objects are the cheapest
thing current garbage collectors (G1, ZGC) handle. Pooled objects become
long-lived and move to the old generation, so the gain from pooling is
questionable and it may even cost more.
* Other frameworks do not do this kind of object pooling of their message or
request objects.
* It is a maintenance burden. Every change in the routing engine must keep both
modes correct, and some bugs only exist in pooled mode. For example, pooled
internal tasks keep a states array sized when they were created (found in the
CAMEL-24978 review).
*Scope*
* Deprecate the {{pooled}} value of the {{exchangeFactory}} option in
camel-main (and Spring Boot / Quarkus configuration), including
{{exchangeFactoryCapacity}} and {{exchangeFactoryStatisticsEnabled}}.
* Deprecate PooledExchangeFactory, PooledProcessorExchangeFactory and the
related classes, and log a WARN when pooling is enabled.
* Mark the exchange-pooling.adoc documentation page as deprecated.
* Add an upgrade guide entry.
* Removal (including CamelInternalPooledTaskFactory and the pooled tasks in the
routing engine) is left for a later release.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)