Examples of Allocator


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

        allocators = new ArrayList<Allocator>( numberOfBuffers );

        for ( int i = 0; i < numberOfBuffers; i++ )
        {
            final Allocator allocator = instanciateByteBufferAllocator( i, size );
            allocators.add( allocator );
        }

        allocationPolicy.init( allocators );
View Full Code Here

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

        throws IOException
    {
        Iterator<Allocator> iterator = allocators.iterator();
        while ( iterator.hasNext() )
        {
            Allocator allocator = iterator.next();
            allocator.close();
            iterator.remove();
        }
        used.set( 0 );
    }
View Full Code Here

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

    @Override
    public Pointer<V> store( byte[] payload, long expiresIn )
    {
        Pointer<V> p = null;
        Allocator allocator = null;
        int allocationNumber = 0;
        do
        {
            allocationNumber++;
            allocator = allocationPolicy.getActiveAllocator( allocator, allocationNumber );
            if ( allocator == null )
            {
                if ( returnsNullWhenFull() )
                {
                    return null;
                }
                else
                {
                    throw new BufferOverflowException();
                }
            }
            final MemoryBuffer buffer = allocator.allocate( payload.length );

            if ( buffer == null )
            {
                continue;
            }

            p = instanciatePointer( buffer, allocator.getNumber(), expiresIn, NEVER_EXPIRES );

            buffer.writerIndex( 0 );
            buffer.writeBytes( payload );

            used.addAndGet( payload.length );
View Full Code Here

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

    public <T extends V> Pointer<V> allocate( final Class<T> type, final int size, final long expiresIn,
                                              final long expires )
    {

        Pointer<V> p = null;
        Allocator allocator = null;
        int allocationNumber = 0;
        do
        {
            allocationNumber++;
            allocator = allocationPolicy.getActiveAllocator( allocator, allocationNumber );
            if ( allocator == null )
            {
                if ( returnsNullWhenFull() )
                {
                    return null;
                }
                else
                {
                    throw new BufferOverflowException();
                }
            }

            final MemoryBuffer buffer = allocator.allocate( size );

            if ( buffer == null )
            {
                continue;
            }

            p = instanciatePointer( buffer, allocator.getNumber(), expiresIn, NEVER_EXPIRES );

            used.addAndGet( size );
        }
        while ( p == null );
View Full Code Here

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

        logger.info( "************************************************" );
    }
   
    public void rawInsert( int megabytes, int howMany )
    {
        Allocator allocator = new MergingByteBufferAllocator( 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

Examples of org.mmtk.utility.alloc.Allocator

      }
      boolean isAcyclic = false//wjw -- I don't have a clue what this is...

      Space spx = Space.getSpaceForObject(object);
      MutatorContext mc = SelectedPlan.ap.mutator();
      Allocator alc = mc.getAllocatorFromSpace(spx)//but alloc is an "int, not an "Allocator".  Go figure...
 
      int [] offs = new int [0];
      /////888888888888888888888888888888
      if (isArr == false)   //build the correct offset table
          {
View Full Code Here

Examples of org.simpleframework.util.buffer.Allocator

   "--mxvercagiykxaqsdvrfabfhfpaseejrg--";        
  
   public void testNoFinalCRLF() throws Exception {
      byte[] data = SOURCE.getBytes("UTF-8");
      byte[] boundary = "mxvercagiykxaqsdvrfabfhfpaseejrg".getBytes("UTF-8");
      Allocator allocator = new ArrayAllocator();
      FileUploadConsumer consumer = new FileUploadConsumer(allocator, boundary, data.length);     
      Cursor cursor = new StreamCursor(data);
     
      while(!consumer.isFinished()) {
         consumer.consume(cursor);
View Full Code Here

Examples of org.simpleframework.util.buffer.Allocator

   }
  
   public void testNoFinalCRLSWithDribble() throws Exception {
      byte[] data = SOURCE.getBytes("UTF-8");
      byte[] boundary = "mxvercagiykxaqsdvrfabfhfpaseejrg".getBytes("UTF-8");
      Allocator allocator = new ArrayAllocator();
      FileUploadConsumer consumer = new FileUploadConsumer(allocator, boundary, data.length);     
      Cursor cursor = new StreamCursor(data);
      DribbleCursor dribble = new DribbleCursor(cursor, 1);
     
      while(!consumer.isFinished()) {
View Full Code Here

Examples of org.simpleframework.util.buffer.Allocator

   }
  
   public void testNoFinalCRLSWithDribble3() throws Exception {
      byte[] data = SOURCE.getBytes("UTF-8");
      byte[] boundary = "mxvercagiykxaqsdvrfabfhfpaseejrg".getBytes("UTF-8");
      Allocator allocator = new ArrayAllocator();
      FileUploadConsumer consumer = new FileUploadConsumer(allocator, boundary, data.length);     
      Cursor cursor = new StreamCursor(data);
      DribbleCursor dribble = new DribbleCursor(cursor, 3);
     
      while(!consumer.isFinished()) {
View Full Code Here

Examples of org.simpleframework.util.buffer.Allocator

      MockRenegotiationServer server = new MockRenegotiationServer(sslContext, false, 10001);     
      server.start();
   }

   public MockRenegotiationServer(SSLContext context, boolean certRequired, int port) throws IOException {
      Allocator allocator = new FileAllocator();
      ContainerProcessor processor = new ContainerProcessor(this, allocator, 4);
      TransportGrabber grabber = new TransportGrabber(processor);
      ProcessorServer processorServer = new ProcessorServer(grabber);
     
      this.server = new ConfigurableCertificateServer(processorServer, certRequired)
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.