From feb8d101bddc032cf55d6c63bc1020ac6930e30a Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Mon, 22 Jul 2013 06:47:29 +0200 Subject: [PATCH] [#1626] Use static fields for default values --- .../java/io/netty/buffer/AbstractByteBufAllocator.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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