diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java b/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java index 307c627d90a..2cbc8bfa712 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/ByteBufferPool.java @@ -24,6 +24,7 @@ import java.util.Deque; import java.util.List; import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; import java.util.function.Consumer; import org.eclipse.jetty.util.BufferUtil; @@ -157,7 +158,7 @@ public interface ByteBufferPool private final int _capacity; private final int _maxSize; private final AtomicInteger _size; - private long _lastUpdate = System.nanoTime(); + private final AtomicLong _lastUpdate = new AtomicLong(System.nanoTime()); public Bucket(int capacity, int maxSize) { @@ -178,7 +179,7 @@ public interface ByteBufferPool public void release(ByteBuffer buffer) { - _lastUpdate = System.nanoTime(); + _lastUpdate.setOpaque(System.nanoTime()); BufferUtil.clear(buffer); if (_size == null) queueOffer(buffer); @@ -233,7 +234,7 @@ public interface ByteBufferPool long getLastUpdate() { - return _lastUpdate; + return _lastUpdate.getOpaque(); } @Override