diff --git a/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicConnection.java b/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicConnection.java index 722d494dbea..e5c1d340b65 100644 --- a/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicConnection.java +++ b/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicConnection.java @@ -17,11 +17,12 @@ import java.io.IOException; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.nio.ByteBuffer; -import java.util.ArrayDeque; import java.util.Collection; import java.util.EventListener; import java.util.List; +import java.util.Queue; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.Executor; @@ -39,7 +40,6 @@ import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.IteratingCallback; import org.eclipse.jetty.util.component.LifeCycle; -import org.eclipse.jetty.util.thread.AutoLock; import org.eclipse.jetty.util.thread.ExecutionStrategy; import org.eclipse.jetty.util.thread.Scheduler; import org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy; @@ -344,26 +344,19 @@ public abstract class QuicConnection extends AbstractConnection private class Flusher extends IteratingCallback { - private final AutoLock lock = new AutoLock(); - private final ArrayDeque queue = new ArrayDeque<>(); + private final Queue queue = new ConcurrentLinkedQueue<>(); private Entry entry; public void offer(Callback callback, SocketAddress address, ByteBuffer[] buffers) { - try (AutoLock l = lock.lock()) - { - queue.offer(new Entry(callback, address, buffers)); - } + queue.offer(new Entry(callback, address, buffers)); iterate(); } @Override protected Action process() { - try (AutoLock l = lock.lock()) - { - entry = queue.poll(); - } + entry = queue.poll(); if (entry == null) return Action.IDLE;