diff --git a/buffer/src/main/java/io/netty/buffer/AbstractByteBufAllocator.java b/buffer/src/main/java/io/netty/buffer/AbstractByteBufAllocator.java index e8e0ee3b17..60be062d0e 100644 --- a/buffer/src/main/java/io/netty/buffer/AbstractByteBufAllocator.java +++ b/buffer/src/main/java/io/netty/buffer/AbstractByteBufAllocator.java @@ -22,6 +22,8 @@ import io.netty.util.internal.PlatformDependent; * Skeltal {@link ByteBufAllocator} implementation to extend. */ public abstract class AbstractByteBufAllocator implements ByteBufAllocator { + private static final int DEFAULT_INITIAL_CAPACITY = 256; + private static final int DEFAULT_MAX_COMPONENTS = 16; private final boolean directByDefault; private final ByteBuf emptyBuf; @@ -94,7 +96,7 @@ public abstract class AbstractByteBufAllocator implements ByteBufAllocator { @Override public ByteBuf heapBuffer() { - return heapBuffer(256, Integer.MAX_VALUE); + return heapBuffer(DEFAULT_INITIAL_CAPACITY, Integer.MAX_VALUE); } @Override @@ -113,7 +115,7 @@ public abstract class AbstractByteBufAllocator implements ByteBufAllocator { @Override public ByteBuf directBuffer() { - return directBuffer(256, Integer.MAX_VALUE); + return directBuffer(DEFAULT_INITIAL_CAPACITY, Integer.MAX_VALUE); } @Override @@ -148,7 +150,7 @@ public abstract class AbstractByteBufAllocator implements ByteBufAllocator { @Override public CompositeByteBuf compositeHeapBuffer() { - return compositeHeapBuffer(16); + return compositeHeapBuffer(DEFAULT_MAX_COMPONENTS); } @Override @@ -158,7 +160,7 @@ public abstract class AbstractByteBufAllocator implements ByteBufAllocator { @Override public CompositeByteBuf compositeDirectBuffer() { - return compositeDirectBuffer(16); + return compositeDirectBuffer(DEFAULT_MAX_COMPONENTS); } @Override