From a810ecf67e272d17b55bdb9500b2fb8f54cbf7bf Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 14 Mar 2018 15:59:37 +1100 Subject: [PATCH] Fixed test with atomic the --task was not protected with a memory barrier, so different producing threads could contend on the field. Signed-off-by: Greg Wilkins --- .../jetty/util/thread/strategy/ExecutionStrategyTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/thread/strategy/ExecutionStrategyTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/thread/strategy/ExecutionStrategyTest.java index 1e4cb87cd19..93b0a21779e 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/thread/strategy/ExecutionStrategyTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/thread/strategy/ExecutionStrategyTest.java @@ -156,11 +156,11 @@ public class ExecutionStrategyTest Producer producer = new TestProducer() { - int tasks=TASKS; + AtomicInteger tasks = new AtomicInteger(TASKS); @Override public Runnable produce() { - final int id = --tasks; + final int id = tasks.decrementAndGet(); if (id>=0) { while(_threads.isRunning())