This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new 7cc31fb61c Issue #8882 : Restore the 1 ms rowset back-off in
BaseTransform on JDK 21 (#8883)
7cc31fb61c is described below
commit 7cc31fb61c6dd04c2eedc685092275c3ea2a4a33
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Mon Oct 12 21:13:53 2026 +0200
Issue #8882 : Restore the 1 ms rowset back-off in BaseTransform on JDK 21
(#8883)
---
core/src/main/java/org/apache/hop/core/SpillingRowSet.java | 11 +++++------
.../org/apache/hop/pipeline/transform/BaseTransform.java | 12 ++++++++----
.../hop/workflow/actions/workflow/ActionWorkflowRunner.java | 3 ++-
.../pipeline/transforms/eventhubs/listen/AzureListener.java | 4 +++-
4 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/core/src/main/java/org/apache/hop/core/SpillingRowSet.java
b/core/src/main/java/org/apache/hop/core/SpillingRowSet.java
index ce80bddfe2..ae4efdcbd3 100644
--- a/core/src/main/java/org/apache/hop/core/SpillingRowSet.java
+++ b/core/src/main/java/org/apache/hop/core/SpillingRowSet.java
@@ -166,12 +166,11 @@ public class SpillingRowSet extends BaseRowSet implements
Comparable<IRowSet>, I
/**
* Reported occupancy for transform flow-control heuristics (not pure
in-memory depth).
*
- * <p>The classic pipeline engine sleeps with {@code Thread.sleep(0, 1)}
when {@code size() >=
- * 99%} of the rowset capacity (producer) or {@code size() <= 1%}
(consumer). On many JVMs/OSes
- * that "1 ns" sleep rounds up to about 1 ms. If we reported a full memory
buffer while spilling
- * (put is non-blocking), every put would sleep ~1 ms — near-zero CPU/disk
and catastrophic
- * throughput. Likewise, reporting {@code 0} while rows still sit only on
disk would make the
- * consumer sleep on every get.
+ * <p>The classic pipeline engine sleeps 1 ms ({@code Thread.sleep(1)}) when
{@code size() >= 99%}
+ * of the rowset capacity (producer) or {@code size() <= 1%} (consumer). If
we reported a full
+ * memory buffer while spilling (put is non-blocking), every put would sleep
~1 ms — near-zero
+ * CPU/disk and catastrophic throughput. Likewise, reporting {@code 0} while
rows still sit only
+ * on disk would make the consumer sleep on every get.
*
* <p>So when there is pending work we advertise a mid-level size (neither
"full" nor "empty").
* When idle we report {@code 0}.
diff --git
a/engine/src/main/java/org/apache/hop/pipeline/transform/BaseTransform.java
b/engine/src/main/java/org/apache/hop/pipeline/transform/BaseTransform.java
index fa729591b6..3a93fd0c9b 100644
--- a/engine/src/main/java/org/apache/hop/pipeline/transform/BaseTransform.java
+++ b/engine/src/main/java/org/apache/hop/pipeline/transform/BaseTransform.java
@@ -1332,7 +1332,8 @@ public class BaseTransform<Meta extends ITransformMeta,
Data extends ITransformD
if (!rs.isDone() && rs.size() >= upperBufferBoundary && !isStopped()) {
try {
- Thread.sleep(0, 1);
+ // A real 1 ms pause: sleep(0, 1) did that until JDK 21, which
sleeps 1 ns (JDK-8305092)
+ Thread.sleep(1);
} catch (InterruptedException e) {
// Ignore sleep interruption exception
}
@@ -1368,7 +1369,8 @@ public class BaseTransform<Meta extends ITransformMeta,
Data extends ITransformD
if (!rs.isDone() && rs.size() >= upperBufferBoundary && !isStopped()) {
try {
- Thread.sleep(0, 1);
+ // A real 1 ms pause: sleep(0, 1) did that until JDK 21, which
sleeps 1 ns (JDK-8305092)
+ Thread.sleep(1);
} catch (InterruptedException e) {
// Ignore sleep interruption exception
}
@@ -1741,7 +1743,8 @@ public class BaseTransform<Meta extends ITransformMeta,
Data extends ITransformD
if (!inputRowSet.isDone() && inputRowSet.size() <= lowerBufferBoundary
&& !isStopped()) {
try {
- Thread.sleep(0, 1);
+ // A real 1 ms pause: sleep(0, 1) did that until JDK 21, which
sleeps 1 ns (JDK-8305092)
+ Thread.sleep(1);
} catch (InterruptedException e) {
// Ignore sleep interruption exception
}
@@ -2096,7 +2099,8 @@ public class BaseTransform<Meta extends ITransformMeta,
Data extends ITransformD
if (!rowSet.isDone() && rowSet.size() <= lowerBufferBoundary &&
!isStopped()) {
try {
- Thread.sleep(0, 1);
+ // A real 1 ms pause: sleep(0, 1) did that until JDK 21, which sleeps
1 ns (JDK-8305092)
+ Thread.sleep(1);
} catch (InterruptedException e) {
// Ignore sleep interruption exception
}
diff --git
a/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/ActionWorkflowRunner.java
b/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/ActionWorkflowRunner.java
index 6b6e300dbc..8127c63442 100644
---
a/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/ActionWorkflowRunner.java
+++
b/plugins/actions/workflow/src/main/java/org/apache/hop/workflow/actions/workflow/ActionWorkflowRunner.java
@@ -140,7 +140,8 @@ public class ActionWorkflowRunner implements Runnable {
public void waitUntilFinished() {
while (!isFinished() && !workflow.isStopped()) {
try {
- Thread.sleep(0, 1);
+ // A real 1 ms pause: sleep(0, 1) did that until JDK 21, which sleeps
1 ns (JDK-8305092)
+ Thread.sleep(1);
} catch (InterruptedException e) {
// Ignore errors
}
diff --git
a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListener.java
b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListener.java
index 275c3eb205..6380438753 100644
---
a/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListener.java
+++
b/plugins/tech/azure/src/main/java/org/apache/hop/pipeline/transforms/eventhubs/listen/AzureListener.java
@@ -321,7 +321,9 @@ public class AzureListener extends
BaseTransform<AzureListenerMeta, AzureListene
//
while (!AzureListener.this.isStopped() &&
!AzureListener.this.outputIsDone()) {
try {
- Thread.sleep(0, 100);
+ // A real 1 ms pause: sleep(0, 100) did that until JDK 21,
which sleeps
+ // 100 ns (JDK-8305092)
+ Thread.sleep(1);
} catch (InterruptedException e) {
// Ignore
}