diff --git a/buffer/src/main/java/io/netty/buffer/PoolChunk.java b/buffer/src/main/java/io/netty/buffer/PoolChunk.java index d02a0b9557..271eea5039 100644 --- a/buffer/src/main/java/io/netty/buffer/PoolChunk.java +++ b/buffer/src/main/java/io/netty/buffer/PoolChunk.java @@ -250,13 +250,13 @@ final class PoolChunk implements PoolChunkMetric { assert pre == null; } - private void removeAvailRun(long handle) { + private void removeAvailRun(Long handle) { int pageIdxFloor = arena.pages2pageIdxFloor(runPages(handle)); PriorityQueue queue = runsAvail[pageIdxFloor]; removeAvailRun(queue, handle); } - private void removeAvailRun(PriorityQueue queue, long handle) { + private void removeAvailRun(PriorityQueue queue, Long handle) { queue.remove(handle); int runOffset = runOffset(handle); @@ -335,9 +335,9 @@ final class PoolChunk implements PoolChunkMetric { //get run with min offset in this queue PriorityQueue queue = runsAvail[queueIdx]; - long handle = queue.poll(); + Long handle = queue.poll(); - assert !isUsed(handle); + assert handle != null && !isUsed(handle); removeAvailRun(queue, handle);