Examples of MemBuffersForBytes


Examples of com.fasterxml.util.membuf.MemBuffersForBytes

public class BufferReuseTest extends MembufTestBase
{
    public void testGlobalReuseWithReads() throws Exception
    {
        ChunkyBytesMemBufferImpl buffer = (ChunkyBytesMemBufferImpl) new MemBuffersForBytes(20, 2, 10).createChunkyBuffer(1, 3);
        SegmentAllocator<?> alloc = buffer.getAllocator();

        assertEquals(1, alloc.getBufferOwnedSegmentCount());
        assertEquals(0, alloc.getReusableSegmentCount());
       
View Full Code Here

Examples of com.fasterxml.util.membuf.MemBuffersForBytes

        assertEquals(2, alloc.getReusableSegmentCount());
    }

    public void testGlobalReuseWithClear() throws Exception
    {
        ChunkyBytesMemBufferImpl buffer = (ChunkyBytesMemBufferImpl) new MemBuffersForBytes(20, 2, 10).createChunkyBuffer(1, 3);
        SegmentAllocator<?> alloc = buffer.getAllocator();

        assertEquals(1, alloc.getBufferOwnedSegmentCount());
        assertEquals(0, alloc.getReusableSegmentCount());
       
View Full Code Here

Examples of com.fasterxml.util.membuf.MemBuffersForBytes

public class BufferCloseTest extends MembufTestBase
{
    public void testClosing() throws Exception
    {
        MemBuffersForBytes bufs = new MemBuffersForBytes(20, 4, 10);
        ChunkyBytesMemBufferImpl buffer = (ChunkyBytesMemBufferImpl)bufs.createChunkyBuffer(2, 3);
        SegmentAllocator<?> alloc = bufs.getAllocator();

        // min size 2, so will allocate 2 right away
        assertEquals(2, alloc.getBufferOwnedSegmentCount());
        assertEquals(0, alloc.getReusableSegmentCount());
       
View Full Code Here

Examples of com.fasterxml.util.membuf.MemBuffersForBytes

            totalSegments = 10;
        }
        int maxPerBuffer = (int) (config.maxPerEntryBuffering.getNumberOfBytes() + OFF_HEAP_BUFFER_SEGMENT_LEN - 1) / OFF_HEAP_BUFFER_SEGMENT_LEN;
        _maxSegmentsPerBuffer = Math.max(2,  maxPerBuffer);
        // and pre-allocate quarter of those buffers right away?
        _offHeapBuffers = new MemBuffersForBytes(OFF_HEAP_BUFFER_SEGMENT_LEN, totalSegments/4, totalSegments);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.