You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/07/28 19:05:48 UTC
[camel] branch camel-3.21.x updated: CAMEL-19679: camel-flatpack - Strange concurrency with DataSet iterator
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.21.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.21.x by this push:
new 4b19f496821 CAMEL-19679: camel-flatpack - Strange concurrency with DataSet iterator
4b19f496821 is described below
commit 4b19f49682119d1d8aec439bd2bf600385d4a032
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jul 28 21:05:09 2023 +0200
CAMEL-19679: camel-flatpack - Strange concurrency with DataSet iterator
---
.../org/apache/camel/component/flatpack/DataSetList.java | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/DataSetList.java b/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/DataSetList.java
index 745b7631629..6834036317b 100644
--- a/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/DataSetList.java
+++ b/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/DataSetList.java
@@ -63,19 +63,17 @@ public class DataSetList extends AbstractList<Map<String, Object>> implements Da
@Override
public Iterator<Map<String, Object>> iterator() {
dataSet.goTop();
+
return new Iterator<Map<String, Object>>() {
- private boolean hasNext = dataSet.next();
+ private int pos = 0;
public boolean hasNext() {
- return hasNext;
+ return pos < size();
}
public Map<String, Object> next() {
- // because of a limitation in split() we need to create an object for the current position
- // otherwise strangeness occurs when the same object is used to represent each row
- Map<String, Object> result = FlatpackConverter.toMap(dataSet);
- hasNext = dataSet.next();
- return result;
+ dataSet.absolute(pos++);
+ return FlatpackConverter.toMap(dataSet);
}
@Override