Here you can find the source of enlargeThreadLocalByteBuffer()
public static ByteBuffer enlargeThreadLocalByteBuffer()
//package com.java2s; /*/*from w ww. j a v a2 s . c o m*/ Pulsar Copyright (C) 2013-2015 eBay Software Foundation Licensed under the GPL v2 license. See LICENSE for full terms. */ import java.nio.ByteBuffer; public class Main { private static final ThreadLocal<ByteBuffer> TMP_BUFFER = new ThreadLocal<ByteBuffer>() { @Override protected ByteBuffer initialValue() { return ByteBuffer.allocate(4096); } }; /** * Double the thread local buffer capacity. * * @return */ public static ByteBuffer enlargeThreadLocalByteBuffer() { TMP_BUFFER.set(ByteBuffer.allocate(TMP_BUFFER.get().capacity() * 2)); return TMP_BUFFER.get(); } }