Package org.apache.accumulo.core.file.blockfile.cache

Examples of org.apache.accumulo.core.file.blockfile.cache.CachedBlockQueue


    CachedBlock cb7 = new CachedBlock(1000, "cb7", 7);
    CachedBlock cb8 = new CachedBlock(1500, "cb8", 8);
    CachedBlock cb9 = new CachedBlock(1000, "cb9", 9);
    CachedBlock cb10 = new CachedBlock(1500, "cb10", 10);
   
    CachedBlockQueue queue = new CachedBlockQueue(10000, 1000);
   
    queue.add(cb1);
    queue.add(cb2);
    queue.add(cb3);
    queue.add(cb4);
    queue.add(cb5);
    queue.add(cb6);
    queue.add(cb7);
    queue.add(cb8);
    queue.add(cb9);
    queue.add(cb10);
   
    // We expect cb1 through cb8 to be in the queue
    long expectedSize = cb1.heapSize() + cb2.heapSize() + cb3.heapSize() + cb4.heapSize() + cb5.heapSize() + cb6.heapSize() + cb7.heapSize() + cb8.heapSize();
   
    assertEquals(queue.heapSize(), expectedSize);
   
    LinkedList<org.apache.accumulo.core.file.blockfile.cache.CachedBlock> blocks = queue.getList();
    assertEquals(blocks.poll().getName(), "cb1");
    assertEquals(blocks.poll().getName(), "cb2");
    assertEquals(blocks.poll().getName(), "cb3");
    assertEquals(blocks.poll().getName(), "cb4");
    assertEquals(blocks.poll().getName(), "cb5");
View Full Code Here


    CachedBlock cb7 = new CachedBlock(1000, "cb7", 7);
    CachedBlock cb8 = new CachedBlock(1500, "cb8", 8);
    CachedBlock cb9 = new CachedBlock(1000, "cb9", 9);
    CachedBlock cb10 = new CachedBlock(1500, "cb10", 10);
   
    CachedBlockQueue queue = new CachedBlockQueue(10000, 1000);
   
    queue.add(cb1);
    queue.add(cb2);
    queue.add(cb3);
    queue.add(cb4);
    queue.add(cb5);
    queue.add(cb6);
    queue.add(cb7);
    queue.add(cb8);
    queue.add(cb9);
    queue.add(cb10);
   
    CachedBlock cb0 = new CachedBlock(10 + CachedBlock.PER_BLOCK_OVERHEAD, "cb0", 0);
    queue.add(cb0);
   
    // This is older so we must include it, but it will not end up kicking
    // anything out because (heapSize - cb8.heapSize + cb0.heapSize < maxSize)
    // and we must always maintain heapSize >= maxSize once we achieve it.
   
    // We expect cb0 through cb8 to be in the queue
    long expectedSize = cb1.heapSize() + cb2.heapSize() + cb3.heapSize() + cb4.heapSize() + cb5.heapSize() + cb6.heapSize() + cb7.heapSize() + cb8.heapSize()
        + cb0.heapSize();
   
    assertEquals(queue.heapSize(), expectedSize);
   
    LinkedList<org.apache.accumulo.core.file.blockfile.cache.CachedBlock> blocks = queue.getList();
    assertEquals(blocks.poll().getName(), "cb0");
    assertEquals(blocks.poll().getName(), "cb1");
    assertEquals(blocks.poll().getName(), "cb2");
    assertEquals(blocks.poll().getName(), "cb3");
    assertEquals(blocks.poll().getName(), "cb4");
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.file.blockfile.cache.CachedBlockQueue

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.