Package org.apache.directmemory.memory.allocator

Examples of org.apache.directmemory.memory.allocator.MergingByteBufferAllocatorImpl


        logger.info( "************************************************" );
    }
   
    public void rawInsert( int megabytes, int howMany )
    {
        ByteBufferAllocator allocator = new MergingByteBufferAllocatorImpl( 1, megabytes * 1024 * 1024 );
        assertNotNull( allocator );
        int size = allocator.getCapacity() / ( howMany );
        size -= size / 100 * 1;
        logger.info( "payload size=" + size );
        logger.info( "entries=" + howMany );

        logger.info( "starting..." );

        long start = System.currentTimeMillis();

        for ( int i = 0; i < howMany; i++ )
        {
            allocator.allocate( size );
        }

        logger.info( "...done in " + ( System.currentTimeMillis() - start ) + " msecs." );
        logger.info( "---------------------------------" );
        dump( allocator );
View Full Code Here


    }


    protected ByteBufferAllocator instanciateByteBufferAllocator( final int allocatorNumber, final int size )
    {
        final MergingByteBufferAllocatorImpl allocator = new MergingByteBufferAllocatorImpl( allocatorNumber, size );

        // Hack to ensure the pointers are always split to keep backward compatibility.
        allocator.setMinSizeThreshold( 0 );
        allocator.setSizeRatioThreshold( 1.0 );

        return allocator;
    }
View Full Code Here

TOP

Related Classes of org.apache.directmemory.memory.allocator.MergingByteBufferAllocatorImpl

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.