This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new e53bbe4 [CAMEL-17616] : improves row counting at
JdbcAggregateRepository startup (#6902)
e53bbe4 is described below
commit e53bbe4fc877935b399e15bd3ba0e37463839040
Author: Benjamin BONNET <[email protected]>
AuthorDate: Wed Feb 9 12:32:03 2022 +0100
[CAMEL-17616] : improves row counting at JdbcAggregateRepository startup
(#6902)
* CAMEL-4271 : recover task in cluster
* Specializing JdbcAggregationRepository for cluster
* CAMEL-17616 : improve row counting at startup
---
.../camel/processor/aggregate/jdbc/JdbcAggregationRepository.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java
b/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java
index 1629fb6..39a7af5 100644
---
a/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java
+++
b/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java
@@ -636,13 +636,17 @@ public class JdbcAggregationRepository extends
ServiceSupport
transactionTemplateReadOnly.setReadOnly(true);
}
+ private int rowCount(final String repository) {
+ return jdbcTemplate.queryForObject("SELECT COUNT(1) FROM " +
repository, Integer.class);
+ }
+
@Override
protected void doStart() throws Exception {
super.doStart();
// log number of existing exchanges
- int current = getKeys().size();
- int completed = scan(null).size();
+ final int current = rowCount(getRepositoryName());
+ final int completed = rowCount(getRepositoryNameCompleted());
if (current > 0) {
LOG.info("On startup there are {} aggregate exchanges (not
completed) in repository: {}", current,