Package org.directmemory.memory

Examples of org.directmemory.memory.Pointer


 
  @BenchmarkOptions(benchmarkRounds = 1000000, warmupRounds=0, concurrency=100)
    @Test
    public void retrieveCatchThemAll() {
      String key = "test-" + (rndGen.nextInt(entries)+1);
      Pointer p = map.get(key);
    read.incrementAndGet();
      if (p != null) {
        got.incrementAndGet();
        byte [] payload = mem.retrieve(p);
          if (key.equals(new String(payload)))
View Full Code Here


 
  @BenchmarkOptions(benchmarkRounds = 1000000, warmupRounds=0, concurrency=100)
    @Test
    public void retrieveCatchHalfOfThem() {
      String key = "test-" + (rndGen.nextInt(entries*2)+1);
      Pointer p = map.get(key);
    read.incrementAndGet();
      if (p != null) {
        got.incrementAndGet();
        byte [] payload = mem.retrieve(p);
          if (key.equals(new String(payload)))
View Full Code Here

         
      }
     
    }
  private void get(String key) {
      Pointer p = map.get(key);
    read.incrementAndGet();
      if (p != null) {
        got.incrementAndGet();
        byte [] payload = mem.retrieve(p);
          if (key.equals(new String(payload)))
View Full Code Here

 
  @BenchmarkOptions(benchmarkRounds = 1000000, warmupRounds=0, concurrency=100)
    @Test
    public void retrieveCatchThemAll() {
      String key = "test-" + (rndGen.nextInt(entries)+1);
      Pointer p = map.get(key);
    read.incrementAndGet();
      if (p != null) {
        got.incrementAndGet();
        byte [] payload = MemoryManager.retrieve(p);
          if (key.equals(new String(payload)))
View Full Code Here

 
  @BenchmarkOptions(benchmarkRounds = 1000000, warmupRounds=0, concurrency=100)
    @Test
    public void retrieveCatchHalfOfThem() {
      String key = "test-" + (rndGen.nextInt(entries*2)+1);
      Pointer p = map.get(key);
    read.incrementAndGet();
      if (p != null) {
        got.incrementAndGet();
        byte [] payload = MemoryManager.retrieve(p);
          if (key.equals(new String(payload)))
View Full Code Here

         
      }
     
    }
  private void get(String key) {
      Pointer p = map.get(key);
    read.incrementAndGet();
      if (p != null) {
        got.incrementAndGet();
        byte [] payload = MemoryManager.retrieve(p);
          if (key.equals(new String(payload)))
View Full Code Here

  @Test
  public void smokeTest() {
    Random rnd = new Random();
    int size = rnd.nextInt(10) * (int)MemoryManager.capacity() / 100;
    logger.info("payload size=" + Ram.inKb(size));
    Pointer p = MemoryManager.store(new byte[size]);
    logger.info("stored");
    assertNotNull(p);
    assertEquals(size,p.end);
    assertEquals(size, MemoryManager.activeBuffer.used());
    MemoryManager.free(p);
View Full Code Here

    long howMany = (MemoryManager.capacity() / payload.length);
    howMany=(howMany*90)/100;
   
   
    for (int i = 0; i < howMany ; i++) {
      Pointer p = MemoryManager.store(payload);
      assertNotNull(p);
    }
   
    logger.info("" + howMany + " items stored");
  }
View Full Code Here

  public static void init(int numberOfBuffers, int size) {
    init(numberOfBuffers, size, DEFAULT_INITIAL_CAPACITY, DEFAULT_CONCURRENCY_LEVEL);
  }

  public static Pointer putByteArray(String key, byte[] payload, int expiresIn) {
    Pointer ptr = MemoryManager.store(payload, expiresIn);
    map.put(key, ptr);
      return ptr;
  }
View Full Code Here

    int howMany = 1000000;
    byte[] payload = str.getBytes();

    logger.info("adding " + howMany + " strings of " + size + " bytes...");
    for (long i = 0; i < howMany; i++) {
      Pointer p = mem.store(payload);
      map.put(i, p);
    }
    logger.info("...done");

  }
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.