mnemonic-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject incubator-mnemonic git commit: MNEMONIC-390: Storage addressing interface
Date Sat, 21 Oct 2017 07:19:49 GMT
Repository: incubator-mnemonic
Updated Branches:
  refs/heads/master 21dbbb19c -> 29822230f


MNEMONIC-390: Storage addressing interface


Project: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/commit/29822230
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/tree/29822230
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/diff/29822230

Branch: refs/heads/master
Commit: 29822230f6f0acb1e684b145896a15b1a73a597a
Parents: 21dbbb1
Author: Wang, Gang(Gary) <gang1.wang@intel.com>
Authored: Fri Oct 20 23:37:25 2017 -0700
Committer: Wang, Gang(Gary) <gang1.wang@intel.com>
Committed: Fri Oct 20 23:47:04 2017 -0700

----------------------------------------------------------------------
 .../org/apache/mnemonic/AddressTranslator.java  | 10 ++++++
 .../mnemonic/NonVolatileMemAllocator.java       | 33 +++++++++++--------
 .../apache/mnemonic/VolatileMemAllocator.java   | 33 +++++++++++--------
 .../memory/VolatileMemoryAllocatorService.java  | 22 +++++++++++--
 .../memory/internal/JavaVMemServiceImpl.java    | 14 +++++---
 .../internal/JavaVMemServiceImplNGTest.java     | 34 ++++++++++----------
 .../memory/internal/PMemServiceImpl.java        | 10 ++++--
 .../memory/internal/VMemServiceImpl.java        | 10 ++++--
 .../memory/internal/PMallocServiceImpl.java     | 10 ++++--
 .../memory/internal/SysVMemServiceImpl.java     | 10 ++++--
 10 files changed, 129 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/29822230/mnemonic-core/src/main/java/org/apache/mnemonic/AddressTranslator.java
----------------------------------------------------------------------
diff --git a/mnemonic-core/src/main/java/org/apache/mnemonic/AddressTranslator.java b/mnemonic-core/src/main/java/org/apache/mnemonic/AddressTranslator.java
index 2c20887..be1203a 100644
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/AddressTranslator.java
+++ b/mnemonic-core/src/main/java/org/apache/mnemonic/AddressTranslator.java
@@ -44,6 +44,16 @@ public interface AddressTranslator {
   long getEffectiveAddress(long addr);
 
   /**
+   * calculate the abstract address from portable address
+   *
+   * @param addr
+   *          the portable address
+   *
+   * @return the abstract address
+   */
+  long getAbstractAddress(long addr);
+
+  /**
    * set address translate table
    *
    * @param tbl

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/29822230/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
----------------------------------------------------------------------
diff --git a/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
b/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
index be545f7..bae656c 100644
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
+++ b/mnemonic-core/src/main/java/org/apache/mnemonic/NonVolatileMemAllocator.java
@@ -30,10 +30,6 @@ import org.flowcomputing.commons.resgc.ReclaimContext;
 
 import java.nio.ByteBuffer;
 
-import static org.apache.mnemonic.service.memory.MemoryServiceFeature.EXPANDABLE;
-import static org.apache.mnemonic.service.memory.MemoryServiceFeature.QUERYABLE;
-import static org.apache.mnemonic.service.memory.MemoryServiceFeature.SHRINKABLE;
-
 /**
  * manage a big native persistent memory pool through underlying memory service.
  * 
@@ -95,15 +91,15 @@ public class NonVolatileMemAllocator extends RestorableAllocator<NonVolatileMemA
      */
     m_chunkcollector = new ResCollector<MemChunkHolder<NonVolatileMemAllocator>,
Long>(new ResReclaim<Long>() {
       @Override
-      public void reclaim(ContextWrapper<Long> rctx) {
-        Long mres = rctx.getRes();
+      public void reclaim(ContextWrapper<Long> cw) {
+        Long mres = cw.getRes();
         // System.out.println(String.format("Reclaim: %X", mres));
         boolean cb_reclaimed = false;
         if (null != m_chunkreclaimer) {
           cb_reclaimed = m_chunkreclaimer.reclaim(mres, null);
         }
         if (!cb_reclaimed) {
-          m_nvmasvc.free(m_nid, mres);
+          m_nvmasvc.free(m_nid, mres, cw.getContext());
           mres = null;
         }
       }
@@ -116,14 +112,14 @@ public class NonVolatileMemAllocator extends RestorableAllocator<NonVolatileMemA
     m_bufcollector = new ResCollector<MemBufferHolder<NonVolatileMemAllocator>,
ByteBuffer>(
         new ResReclaim<ByteBuffer>() {
           @Override
-          public void reclaim(ContextWrapper<ByteBuffer> rctx) {
-            ByteBuffer mres = rctx.getRes();
+          public void reclaim(ContextWrapper<ByteBuffer> cw) {
+            ByteBuffer mres = cw.getRes();
             boolean cb_reclaimed = false;
             if (null != m_bufferreclaimer) {
               cb_reclaimed = m_bufferreclaimer.reclaim(mres, Long.valueOf(mres.capacity()));
             }
             if (!cb_reclaimed) {
-              m_nvmasvc.destroyByteBuffer(m_nid, mres);
+              m_nvmasvc.destroyByteBuffer(m_nid, mres, cw.getContext());
               mres = null;
             }
           }
@@ -607,6 +603,17 @@ public class NonVolatileMemAllocator extends RestorableAllocator<NonVolatileMemA
     throw new AddressTranslateError("Effective Address Translate Error");
   }
 
+  @Override
+  public long getAbstractAddress(long addr) {
+    long ret = 0L;
+    if (m_absaddr) {
+      ret = m_nvmasvc.getAbstractAddress(addr);
+    } else {
+      throw new ConfigurationException("Do not support get abstract address operation");
+    }
+    return ret;
+  }
+
   /**
    * get the address translate table
    *
@@ -718,7 +725,7 @@ public class NonVolatileMemAllocator extends RestorableAllocator<NonVolatileMemA
    */
   Queryable useQuery() {
     if (null == m_querable) {
-      if (m_features.contains(QUERYABLE)) {
+      if (m_features.contains(MemoryServiceFeature.QUERYABLE)) {
         m_querable = new MemoryQueryAdapter();
       }
     }
@@ -729,7 +736,7 @@ public class NonVolatileMemAllocator extends RestorableAllocator<NonVolatileMemA
   public long expand(long size) {
     long ret = 0L;
     if (null != m_features) {
-      if (m_features.contains(EXPANDABLE)) {
+      if (m_features.contains(MemoryServiceFeature.EXPANDABLE)) {
         ret = m_nvmasvc.adjustCapacity(m_nid, size);
       } else {
         throw new ConfigurationException("Do not support expand operation");
@@ -744,7 +751,7 @@ public class NonVolatileMemAllocator extends RestorableAllocator<NonVolatileMemA
   public long shrink(long size) {
     long ret = 0L;
     if (null != m_features) {
-      if (m_features.contains(SHRINKABLE)) {
+      if (m_features.contains(MemoryServiceFeature.SHRINKABLE)) {
         ret = m_nvmasvc.adjustCapacity(m_nid, (-1) * size);
       } else {
         throw new ConfigurationException("Do not support shrink operation");

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/29822230/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java
----------------------------------------------------------------------
diff --git a/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java b/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java
index b78f2f3..a79e18a 100644
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java
+++ b/mnemonic-core/src/main/java/org/apache/mnemonic/VolatileMemAllocator.java
@@ -30,10 +30,6 @@ import org.flowcomputing.commons.resgc.ReclaimContext;
 
 import java.nio.ByteBuffer;
 
-import static org.apache.mnemonic.service.memory.MemoryServiceFeature.EXPANDABLE;
-import static org.apache.mnemonic.service.memory.MemoryServiceFeature.QUERYABLE;
-import static org.apache.mnemonic.service.memory.MemoryServiceFeature.SHRINKABLE;
-
 /**
  * manage a big native memory pool through underlying memory service.
  * 
@@ -86,14 +82,14 @@ public class VolatileMemAllocator extends RestorableAllocator<VolatileMemAllocat
      */
     m_bufcollector = new ResCollector<MemBufferHolder<VolatileMemAllocator>, ByteBuffer>(new
ResReclaim<ByteBuffer>() {
       @Override
-      public void reclaim(ContextWrapper<ByteBuffer> rctx) {
-        ByteBuffer mres = rctx.getRes();
+      public void reclaim(ContextWrapper<ByteBuffer> cw) {
+        ByteBuffer mres = cw.getRes();
         boolean cb_reclaimed = false;
         if (null != m_bufferreclaimer) {
           cb_reclaimed = m_bufferreclaimer.reclaim(mres, Long.valueOf(mres.capacity()));
         }
         if (!cb_reclaimed) {
-          m_vmasvc.destroyByteBuffer(m_nid, mres);
+          m_vmasvc.destroyByteBuffer(m_nid, mres, cw.getContext());
           mres = null;
         }
       }
@@ -105,15 +101,15 @@ public class VolatileMemAllocator extends RestorableAllocator<VolatileMemAllocat
      */
     m_chunkcollector = new ResCollector<MemChunkHolder<VolatileMemAllocator>, Long>(new
ResReclaim<Long>() {
       @Override
-      public void reclaim(ContextWrapper<Long> rctx) {
-        Long mres = rctx.getRes();
+      public void reclaim(ContextWrapper<Long> cw) {
+        Long mres = cw.getRes();
         // System.out.println(String.format("Reclaim: %X", mres));
         boolean cb_reclaimed = false;
         if (null != m_chunkreclaimer) {
           cb_reclaimed = m_chunkreclaimer.reclaim(mres, null);
         }
         if (!cb_reclaimed) {
-          m_vmasvc.free(m_nid, mres);
+          m_vmasvc.free(m_nid, mres, cw.getContext());
           mres = null;
         }
       }
@@ -151,7 +147,7 @@ public class VolatileMemAllocator extends RestorableAllocator<VolatileMemAllocat
   public long expand(long size) {
     long ret = 0L;
     if (null != m_features) {
-      if (m_features.contains(EXPANDABLE)) {
+      if (m_features.contains(MemoryServiceFeature.EXPANDABLE)) {
         ret = m_vmasvc.adjustCapacity(m_nid, size);
       } else {
         throw new ConfigurationException("Do not support expand operation");
@@ -166,7 +162,7 @@ public class VolatileMemAllocator extends RestorableAllocator<VolatileMemAllocat
   public long shrink(long size) {
     long ret = 0L;
     if (null != m_features) {
-      if (m_features.contains(SHRINKABLE)) {
+      if (m_features.contains(MemoryServiceFeature.SHRINKABLE)) {
         ret = m_vmasvc.adjustCapacity(m_nid, (-1) * size);
       } else {
         throw new ConfigurationException("Do not support shrink operation");
@@ -539,6 +535,17 @@ public class VolatileMemAllocator extends RestorableAllocator<VolatileMemAllocat
     throw new AddressTranslateError("Effective Address Translate Error");
   }
 
+  @Override
+  public long getAbstractAddress(long addr) {
+    long ret = 0L;
+    if (m_absaddr) {
+      ret = m_vmasvc.getAbstractAddress(addr);
+    } else {
+      throw new ConfigurationException("Do not support get abstract address operation");
+    }
+    return ret;
+  }
+
   /**
    * get the address translate table
    *
@@ -651,7 +658,7 @@ public class VolatileMemAllocator extends RestorableAllocator<VolatileMemAllocat
    */
   Queryable useQuery() {
     if (null == m_querable) {
-      if (m_features.contains(QUERYABLE)) {
+      if (m_features.contains(MemoryServiceFeature.QUERYABLE)) {
         m_querable = new MemoryQueryAdapter();
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/29822230/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/VolatileMemoryAllocatorService.java
----------------------------------------------------------------------
diff --git a/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/VolatileMemoryAllocatorService.java
b/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/VolatileMemoryAllocatorService.java
index 1b3f9bf..72c53bc 100644
--- a/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/VolatileMemoryAllocatorService.java
+++ b/mnemonic-core/src/main/java/org/apache/mnemonic/service/memory/VolatileMemoryAllocatorService.java
@@ -17,6 +17,8 @@
 
 package org.apache.mnemonic.service.memory;
 
+import org.flowcomputing.commons.resgc.ReclaimContext;
+
 import java.nio.ByteBuffer;
 import java.util.Set;
 
@@ -227,8 +229,11 @@ public interface VolatileMemoryAllocatorService extends QueryableService
{
    * 
    * @param addr
    *          the address of allocated memory block.
+   *
+   * @param rctx
+   *          the reclaim context.
    */
-  void free(long id, long addr);
+  void free(long id, long addr, ReclaimContext rctx);
 
   /**
    * create a ByteBuffer object which backed buffer is coming from backed native
@@ -272,8 +277,11 @@ public interface VolatileMemoryAllocatorService extends QueryableService
{
    * 
    * @param bytebuf
    *          the specified ByteBuffer object to be destroyed
+   *
+   * @param rctx
+   *          the reclaim context.
    */
-  void destroyByteBuffer(long id, ByteBuffer bytebuf);
+  void destroyByteBuffer(long id, ByteBuffer bytebuf, ReclaimContext rctx);
 
   /**
    * begin a transaction
@@ -305,4 +313,14 @@ public interface VolatileMemoryAllocatorService extends QueryableService
{
    */
   Set<MemoryServiceFeature> getFeatures();
 
+  /**
+   * calculate the abstract address from portable address
+   *
+   * @param addr
+   *          the portable address
+   *
+   * @return the abstract address
+   */
+  long getAbstractAddress(long addr);
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/29822230/mnemonic-memory-services/mnemonic-java-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/JavaVMemServiceImpl.java
----------------------------------------------------------------------
diff --git a/mnemonic-memory-services/mnemonic-java-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/JavaVMemServiceImpl.java
b/mnemonic-memory-services/mnemonic-java-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/JavaVMemServiceImpl.java
index 8d6e959..d98d04b 100644
--- a/mnemonic-memory-services/mnemonic-java-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/JavaVMemServiceImpl.java
+++ b/mnemonic-memory-services/mnemonic-java-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/JavaVMemServiceImpl.java
@@ -24,6 +24,7 @@ import org.apache.mnemonic.query.memory.ResultSet;
 import org.apache.mnemonic.service.computing.ValueInfo;
 import org.apache.mnemonic.service.memory.MemoryServiceFeature;
 import org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService;
+import org.flowcomputing.commons.resgc.ReclaimContext;
 
 import java.io.File;
 import java.io.IOException;
@@ -211,13 +212,13 @@ public class JavaVMemServiceImpl implements VolatileMemoryAllocatorService
{
     originalBytebuf.rewind();
     newBytebuf.rewind();
     newBytebuf.put(originalBytebuf);
-    destroyByteBuffer(id, originalBytebuf);
+    destroyByteBuffer(id, originalBytebuf, null);
     handler = getByteBufferHandler(id, newBytebuf);
     return handler;
   }
 
   @Override
-  public void free(long id, long addr) {
+  public void free(long id, long addr, ReclaimContext rctx) {
     MemoryInfo mi = this.getMemPools().get((int)id);
     FileChannel channel = mi.getFileChannel();
     int startIdx, requiredblocks, size;
@@ -273,12 +274,12 @@ public class JavaVMemServiceImpl implements VolatileMemoryAllocatorService
{
     ByteBuffer bb = createByteBuffer(id, size);
     bytebuf.rewind();
     bb.put(bytebuf);
-    destroyByteBuffer(id, bytebuf);
+    destroyByteBuffer(id, bytebuf, null);
     return bb;
   }
 
   @Override
-  public void destroyByteBuffer(long id, ByteBuffer bytebuf) {
+  public void destroyByteBuffer(long id, ByteBuffer bytebuf, ReclaimContext rctx) {
     MemoryInfo mi = this.getMemPools().get((int)id);
     FileChannel channel = mi.getFileChannel();
     int startIdx, requiredblocks;
@@ -390,6 +391,11 @@ public class JavaVMemServiceImpl implements VolatileMemoryAllocatorService
{
     return null;
   }
 
+  @Override
+  public long getAbstractAddress(long addr) {
+    throw new UnsupportedOperationException("Unrsupported to get abstract address");
+  }
+
   public ArrayList<MemoryInfo> getMemPools() {
     return this.mem_pools;
   }

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/29822230/mnemonic-memory-services/mnemonic-java-vmem-service/src/test/java/org/apache/mnemonic/service/memory/internal/JavaVMemServiceImplNGTest.java
----------------------------------------------------------------------
diff --git a/mnemonic-memory-services/mnemonic-java-vmem-service/src/test/java/org/apache/mnemonic/service/memory/internal/JavaVMemServiceImplNGTest.java
b/mnemonic-memory-services/mnemonic-java-vmem-service/src/test/java/org/apache/mnemonic/service/memory/internal/JavaVMemServiceImplNGTest.java
index e633218..cb5b140 100644
--- a/mnemonic-memory-services/mnemonic-java-vmem-service/src/test/java/org/apache/mnemonic/service/memory/internal/JavaVMemServiceImplNGTest.java
+++ b/mnemonic-memory-services/mnemonic-java-vmem-service/src/test/java/org/apache/mnemonic/service/memory/internal/JavaVMemServiceImplNGTest.java
@@ -219,7 +219,7 @@ public class JavaVMemServiceImplNGTest {
     assertTrue(blockInfo.getBufferBlockChunksMap().size() == 10 * 1024 * 1024 / 512);
     assertTrue(blockInfo.getBufferBlockChunksMap().get(0) == true);
     assertTrue(blockInfo.getBufferBlockChunksMap().get(1) == false);
-    vms.destroyByteBuffer(memPool, bytebuffer);
+    vms.destroyByteBuffer(memPool, bytebuffer, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }
@@ -243,7 +243,7 @@ public class JavaVMemServiceImplNGTest {
     assertTrue(blockInfo.getBufferBlockChunksMap().size() == 10 * 1024 * 1024 / 512);
     assertTrue(blockInfo.getBufferBlockChunksMap().get(0) == true);
     assertTrue(blockInfo.getBufferBlockChunksMap().get(1) == false);
-    vms.destroyByteBuffer(memPool, bytebuffer);
+    vms.destroyByteBuffer(memPool, bytebuffer, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }
@@ -269,7 +269,7 @@ public class JavaVMemServiceImplNGTest {
     assertTrue(blockInfo.getBufferBlockChunksMap().get(1) == true);
     assertTrue(blockInfo.getBufferBlockChunksMap().get(2) == true);
     assertTrue(blockInfo.getBufferBlockChunksMap().get(3) == false);
-    vms.destroyByteBuffer(memPool, bytebuffer);
+    vms.destroyByteBuffer(memPool, bytebuffer, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }
@@ -293,7 +293,7 @@ public class JavaVMemServiceImplNGTest {
     assertTrue(blockInfo.getBufferBlockChunksMap().size() == 10 * 1024 * 1024 / 512);
     assertTrue(blockInfo.getBufferBlockChunksMap().get(0) == true);
     assertTrue(blockInfo.getBufferBlockChunksMap().get(10 * 1024 * 1024 / 512 - 1) == true);
-    vms.destroyByteBuffer(memPool, bytebuffer);
+    vms.destroyByteBuffer(memPool, bytebuffer, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }
@@ -331,8 +331,8 @@ public class JavaVMemServiceImplNGTest {
     }
     assertTrue(keys.get(0) != keys.get(1));
 
-    vms.destroyByteBuffer(memPool, bytebuffer1);
-    vms.destroyByteBuffer(memPool, bytebuffer2);
+    vms.destroyByteBuffer(memPool, bytebuffer1, null);
+    vms.destroyByteBuffer(memPool, bytebuffer2, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }
@@ -369,7 +369,7 @@ public class JavaVMemServiceImplNGTest {
     assertTrue(blocksMap.get(10 * 1024 * 1024 / 512 - 1) == false);
     assertTrue(blockInfo.getChunkSizeMap().size() == 1);
 
-    vms.destroyByteBuffer(memPool, bytebuffer1);
+    vms.destroyByteBuffer(memPool, bytebuffer1, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }
@@ -392,12 +392,12 @@ public class JavaVMemServiceImplNGTest {
     ByteBuffer bytebuffer2 = vms.createByteBuffer(memPool, 10 * 1024 * 1024 - 1024);
 
     // Destroy bytebuffer2 first, then destroy bytebuffer1
-    vms.destroyByteBuffer(memPool, bytebuffer2);
+    vms.destroyByteBuffer(memPool, bytebuffer2, null);
     assertTrue(blockInfo.getChunkSizeMap().size() == 1);
     assertTrue(blockInfo.getBufferBlockChunksMap().get(2) == false);
     assertTrue(blockInfo.getBufferBlockChunksMap().get(10 * 1024 * 1024 / 512 - 1) == false);
 
-    vms.destroyByteBuffer(memPool, bytebuffer1);
+    vms.destroyByteBuffer(memPool, bytebuffer1, null);
     assertTrue(blockInfo.getChunkSizeMap().size() == 0);
     assertTrue(blockInfo.getBufferBlockChunksMap().get(0) == false);
     assertTrue(blockInfo.getBufferBlockChunksMap().get(1) == false);
@@ -430,7 +430,7 @@ public class JavaVMemServiceImplNGTest {
       Assert.assertEquals(bytebuffer2.get(i), (byte)i);
     }
 
-    vms.destroyByteBuffer(memPool, bytebuffer2);
+    vms.destroyByteBuffer(memPool, bytebuffer2, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }
@@ -453,7 +453,7 @@ public class JavaVMemServiceImplNGTest {
     assertTrue(blockInfo.getBufferBlockBaseAddress() > 0);
     ByteBuffer bb = vms.retrieveByteBuffer(memPool, blockInfo.getBufferBlockBaseAddress());
     Assert.assertEquals(bb, bytebuffer);
-    vms.destroyByteBuffer(memPool, bytebuffer);
+    vms.destroyByteBuffer(memPool, bytebuffer, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }
@@ -476,7 +476,7 @@ public class JavaVMemServiceImplNGTest {
     assertTrue(blockInfo.getBufferBlockBaseAddress() > 0);
     long size = vms.retrieveSize(memPool, blockInfo.getBufferBlockBaseAddress());
     Assert.assertEquals((int)size, 512);
-    vms.destroyByteBuffer(memPool, bytebuffer);
+    vms.destroyByteBuffer(memPool, bytebuffer, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }
@@ -499,7 +499,7 @@ public class JavaVMemServiceImplNGTest {
     assertTrue(blockInfo.getBufferBlockBaseAddress() > 0);
     long handler = vms.getByteBufferHandler(memPool, bytebuffer);
     Assert.assertEquals(handler, blockInfo.getBufferBlockBaseAddress());
-    vms.destroyByteBuffer(memPool, bytebuffer);
+    vms.destroyByteBuffer(memPool, bytebuffer, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }
@@ -524,7 +524,7 @@ public class JavaVMemServiceImplNGTest {
     for (int i = 0; i < 513; i++) {
       Assert.assertEquals(bb.get(i), (byte)0); //initiate to zero regardless of whether initzero
= false
     }
-    vms.destroyByteBuffer(memPool, bb);
+    vms.destroyByteBuffer(memPool, bb, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }
@@ -549,7 +549,7 @@ public class JavaVMemServiceImplNGTest {
     for (int i = 0; i < bb.capacity(); i++) {
       Assert.assertEquals(bb.get(i), (byte)0);
     }
-    vms.destroyByteBuffer(memPool, bb);
+    vms.destroyByteBuffer(memPool, bb, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }
@@ -575,7 +575,7 @@ public class JavaVMemServiceImplNGTest {
     for (int i = 0; i < bb.capacity(); i++) {
       Assert.assertEquals(bb.get(i), (byte)0);
     }
-    vms.destroyByteBuffer(memPool, bb);
+    vms.destroyByteBuffer(memPool, bb, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }
@@ -602,7 +602,7 @@ public class JavaVMemServiceImplNGTest {
     for (int i = 0; i < bb.capacity(); i++) {
       Assert.assertEquals(bb.get(i), (byte)0);
     }
-    vms.destroyByteBuffer(memPool, bb);
+    vms.destroyByteBuffer(memPool, bb, null);
     vms.close(memPool);
     Files.delete(Paths.get(dest));
   }

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/29822230/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/PMemServiceImpl.java
----------------------------------------------------------------------
diff --git a/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/PMemServiceImpl.java
b/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/PMemServiceImpl.java
index b6c69b0..ce61e90 100644
--- a/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/PMemServiceImpl.java
+++ b/mnemonic-memory-services/mnemonic-nvml-pmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/PMemServiceImpl.java
@@ -23,6 +23,7 @@ import org.apache.mnemonic.service.computing.ValueInfo;
 import org.apache.mnemonic.service.memory.MemoryServiceFeature;
 import org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService;
 import org.flowcomputing.commons.primitives.NativeLibraryLoader;
+import org.flowcomputing.commons.resgc.ReclaimContext;
 
 import java.nio.ByteBuffer;
 import java.util.HashSet;
@@ -78,7 +79,7 @@ public class PMemServiceImpl implements NonVolatileMemoryAllocatorService
{
   }
 
   @Override
-  public void free(long id, long addr) {
+  public void free(long id, long addr, ReclaimContext rctx) {
     nfree(id, addr);
   }
 
@@ -93,7 +94,7 @@ public class PMemServiceImpl implements NonVolatileMemoryAllocatorService
{
   }
 
   @Override
-  public void destroyByteBuffer(long id, ByteBuffer bytebuf) {
+  public void destroyByteBuffer(long id, ByteBuffer bytebuf, ReclaimContext rctx) {
     ndestroyByteBuffer(id, bytebuf);
   }
 
@@ -175,6 +176,11 @@ public class PMemServiceImpl implements NonVolatileMemoryAllocatorService
{
     return ret;
   }
 
+  @Override
+  public long getAbstractAddress(long addr) {
+    throw new UnsupportedOperationException("Unrsupported to get abstract address");
+  }
+
   protected native long ninit(long capacity, String uri, boolean isnew);
 
   protected native void nclose(long id);

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/29822230/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/VMemServiceImpl.java
----------------------------------------------------------------------
diff --git a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/VMemServiceImpl.java
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/VMemServiceImpl.java
index 6c88ed6..eb823b3 100644
--- a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/VMemServiceImpl.java
+++ b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/VMemServiceImpl.java
@@ -23,6 +23,7 @@ import org.apache.mnemonic.service.computing.ValueInfo;
 import org.apache.mnemonic.service.memory.MemoryServiceFeature;
 import org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService;
 import org.flowcomputing.commons.primitives.NativeLibraryLoader;
+import org.flowcomputing.commons.resgc.ReclaimContext;
 
 import java.nio.ByteBuffer;
 import java.util.Collections;
@@ -85,7 +86,7 @@ public class VMemServiceImpl implements VolatileMemoryAllocatorService {
   }
 
   @Override
-  public void free(long id, long addr) {
+  public void free(long id, long addr, ReclaimContext rctx) {
     nfree(id, addr);
   }
 
@@ -100,7 +101,7 @@ public class VMemServiceImpl implements VolatileMemoryAllocatorService
{
   }
 
   @Override
-  public void destroyByteBuffer(long id, ByteBuffer bytebuf) {
+  public void destroyByteBuffer(long id, ByteBuffer bytebuf, ReclaimContext rctx) {
     ndestroyByteBuffer(id, bytebuf);
   }
 
@@ -167,6 +168,11 @@ public class VMemServiceImpl implements VolatileMemoryAllocatorService
{
     return ret;
   }
 
+  @Override
+  public long getAbstractAddress(long addr) {
+    throw new UnsupportedOperationException("Unrsupported to get abstract address");
+  }
+
   protected native long ninit(long capacity, String uri, boolean isnew);
 
   protected native void nclose(long id);

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/29822230/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memory/internal/PMallocServiceImpl.java
----------------------------------------------------------------------
diff --git a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memory/internal/PMallocServiceImpl.java
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memory/internal/PMallocServiceImpl.java
index e6c6165..b83d49c 100644
--- a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memory/internal/PMallocServiceImpl.java
+++ b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memory/internal/PMallocServiceImpl.java
@@ -23,6 +23,7 @@ import org.apache.mnemonic.service.computing.ValueInfo;
 import org.apache.mnemonic.service.memory.MemoryServiceFeature;
 import org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService;
 import org.flowcomputing.commons.primitives.NativeLibraryLoader;
+import org.flowcomputing.commons.resgc.ReclaimContext;
 
 import java.nio.ByteBuffer;
 import java.util.HashSet;
@@ -78,7 +79,7 @@ public class PMallocServiceImpl implements NonVolatileMemoryAllocatorService
{
   }
 
   @Override
-  public void free(long id, long addr) {
+  public void free(long id, long addr, ReclaimContext rctx) {
     nfree(id, addr);
   }
 
@@ -93,7 +94,7 @@ public class PMallocServiceImpl implements NonVolatileMemoryAllocatorService
{
   }
 
   @Override
-  public void destroyByteBuffer(long id, ByteBuffer bytebuf) {
+  public void destroyByteBuffer(long id, ByteBuffer bytebuf, ReclaimContext rctx) {
     ndestroyByteBuffer(id, bytebuf);
   }
 
@@ -175,6 +176,11 @@ public class PMallocServiceImpl implements NonVolatileMemoryAllocatorService
{
     return ret;
   }
 
+  @Override
+  public long getAbstractAddress(long addr) {
+    throw new UnsupportedOperationException("Unrsupported to get abstract address");
+  }
+
   protected native long ninit(long capacity, String uri, boolean isnew);
 
   protected native void nclose(long id);

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/29822230/mnemonic-memory-services/mnemonic-sys-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/SysVMemServiceImpl.java
----------------------------------------------------------------------
diff --git a/mnemonic-memory-services/mnemonic-sys-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/SysVMemServiceImpl.java
b/mnemonic-memory-services/mnemonic-sys-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/SysVMemServiceImpl.java
index 5b26008..73a3e59 100644
--- a/mnemonic-memory-services/mnemonic-sys-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/SysVMemServiceImpl.java
+++ b/mnemonic-memory-services/mnemonic-sys-vmem-service/src/main/java/org/apache/mnemonic/service/memory/internal/SysVMemServiceImpl.java
@@ -23,6 +23,7 @@ import org.apache.mnemonic.service.computing.ValueInfo;
 import org.apache.mnemonic.service.memory.MemoryServiceFeature;
 import org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService;
 import org.flowcomputing.commons.primitives.NativeLibraryLoader;
+import org.flowcomputing.commons.resgc.ReclaimContext;
 
 import java.nio.ByteBuffer;
 import java.util.Collections;
@@ -85,7 +86,7 @@ public class SysVMemServiceImpl implements VolatileMemoryAllocatorService
{
   }
 
   @Override
-  public void free(long id, long addr) {
+  public void free(long id, long addr, ReclaimContext rctx) {
     nfree(id, addr);
   }
 
@@ -100,7 +101,7 @@ public class SysVMemServiceImpl implements VolatileMemoryAllocatorService
{
   }
 
   @Override
-  public void destroyByteBuffer(long id, ByteBuffer bytebuf) {
+  public void destroyByteBuffer(long id, ByteBuffer bytebuf, ReclaimContext rctx) {
     ndestroyByteBuffer(id, bytebuf);
   }
 
@@ -167,6 +168,11 @@ public class SysVMemServiceImpl implements VolatileMemoryAllocatorService
{
     return ret;
   }
 
+  @Override
+  public long getAbstractAddress(long addr) {
+    throw new UnsupportedOperationException("Unrsupported to get abstract address");
+  }
+
   protected native long ninit(long capacity, String uri, boolean isnew);
 
   protected native void nclose(long id);


Mime
View raw message