public static BufferPool getBufferPool() { if (instance == null) { synchronized (BufferPool.class) { if (instance == null) { BufferPoolAPI pool = new BufferPool15Impl(); pool.setMaxSize(DEFAULT_POOL_SIZE); log.info( "Created a buffer pool with max size:" + DEFAULT_POOL_SIZE + " bytes of type: " + pool.getClass().getName()); instance = new BufferPool(pool); } } } return instance; }
public void returnBuffer(XByteBuffer buffer) { if (pool != null) pool.returnBuffer(buffer); }
public void clear() { if (pool != null) pool.clear(); }
public XByteBuffer getBuffer(int minSize, boolean discard) { if (pool != null) return pool.getBuffer(minSize, discard); else return new XByteBuffer(minSize, discard); }