From 66e1f0a863d226d7c8720d0351ff406ceb5018da Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Sat, 7 Mar 2015 22:35:02 +0100 Subject: [PATCH] Made the tag counter a non-static variable. This was needed to avoid random test failures where a test running before another could increase the tag and fail the test. --- .../org/eclipse/jetty/io/MappedByteBufferPool.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/MappedByteBufferPool.java b/jetty-io/src/main/java/org/eclipse/jetty/io/MappedByteBufferPool.java index b3c08d34e75..9b43660531a 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/MappedByteBufferPool.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/MappedByteBufferPool.java @@ -119,23 +119,23 @@ public class MappedByteBufferPool implements ByteBufferPool { return direct ? directBuffers : heapBuffers; } - - private static AtomicInteger __tag = new AtomicInteger(); - + public static class Tagged extends MappedByteBufferPool { + private final AtomicInteger tag = new AtomicInteger(); + public ByteBuffer createIndirect(int capacity) { - ByteBuffer buffer = BufferUtil.allocate(capacity+4); + ByteBuffer buffer = BufferUtil.allocate(capacity + 4); buffer.limit(4); - buffer.putInt(0,__tag.incrementAndGet()); + buffer.putInt(0, tag.incrementAndGet()); buffer.position(4); buffer.limit(buffer.capacity()); ByteBuffer slice = buffer.slice(); BufferUtil.clear(slice); return slice; } - + protected ByteBuffer createDirect(int capacity) { return createIndirect(capacity);