Package com.fasterxml.util.membuf

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


        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

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

            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

Related Classes of com.fasterxml.util.membuf.MemBuffersForBytes

Copyright © 2018 www.massapicom. 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.