Package org.directmemory.memory

Examples of org.directmemory.memory.Pointer


    logger.info("payload size is variable");
    logger.info("entries=" + howMany);
    String test = "this is a nicely crafted test";
    for (int i = 0; i < howMany; i++) {
      final byte[] payload = (test + " - " + i).getBytes();
      Pointer p = mem.store(payload);
      final byte[] check = mem.retrieve(p);
      assertNotNull(check);
      assertEquals(test + " - " + i, new String(check));
      long crc1 = OffHeapMemoryBuffer.crc32(payload);
      long crc2 = OffHeapMemoryBuffer.crc32(check);
View Full Code Here


    assertNotNull(mem);   
    int howMany = 10;
    logger.info("payload size is variable");
    logger.info("entries=" + howMany);
    String test = "this is a nicely crafted test";
    Pointer lastP = null;
    for (int i = 0; i < howMany; i++) {
      byte[] payload = (test + " - " + i).getBytes();
      Pointer p = mem.store(payload);
      logger.info("p.start=" + p.start);
      logger.info("p.end=" + p.end);
      if (lastP != null) {
        assertEquals(lastP.end +1, p.start);
      }
View Full Code Here

      String key = "test-" + (rndGen.nextInt(entries*2)+1);
      get(key);
    }
 
  private void get(String key) {
      Pointer p = map.get(key);
    read.incrementAndGet();
      if (p != null) {
        got.incrementAndGet();
        byte [] payload = MemoryManager.retrieve(p);
          if ((new String(payload)).startsWith(key))
View Full Code Here

TOP

Related Classes of org.directmemory.memory.Pointer

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.