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.
This commit is contained in:
Simone Bordet 2015-03-07 22:35:02 +01:00
parent d63ed9864d
commit 66e1f0a863
1 changed files with 6 additions and 6 deletions

View File

@ -120,15 +120,15 @@ 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();