mnemonic-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yz...@apache.org
Subject [mnemonic] branch master updated: MNEMONIC-620: Add Utils.getVolatileMemoryAllocatorService call back to Example
Date Wed, 17 Feb 2021 00:48:43 GMT
This is an automated email from the ASF dual-hosted git repository.

yzhao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mnemonic.git


The following commit(s) were added to refs/heads/master by this push:
     new 7477a50  MNEMONIC-620: Add Utils.getVolatileMemoryAllocatorService call back to Example
7477a50 is described below

commit 7477a5039d58b0509cb7d69ac4d4e5456a6296c5
Author: Xiaojin Jiao <xj.jiao@gmail.com>
AuthorDate: Sun Feb 14 16:58:10 2021 -0800

    MNEMONIC-620: Add Utils.getVolatileMemoryAllocatorService call back to Example
    
    Signed-off-by: Xiaojin Jiao <xj.jiao@gmail.com>
---
 .../src/main/java/org/apache/mnemonic/examples/CreateOrder.java      | 4 ++--
 .../src/main/java/org/apache/mnemonic/examples/HelloWorld.java       | 3 +--
 .../src/main/java/org/apache/mnemonic/examples/Main.java             | 5 +----
 .../src/main/java/org/apache/mnemonic/examples/ShowOrder.java        | 4 ++--
 4 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/CreateOrder.java
b/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/CreateOrder.java
index 6d655f4..d30f447 100644
--- a/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/CreateOrder.java
+++ b/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/CreateOrder.java
@@ -21,9 +21,9 @@ import org.apache.mnemonic.DurableType;
 import org.apache.mnemonic.EntityFactoryProxy;
 import org.apache.mnemonic.EntityFactoryProxyHelper;
 import org.apache.mnemonic.NonVolatileMemAllocator;
+import org.apache.mnemonic.Utils;
 import org.apache.mnemonic.collections.DurableSinglyLinkedList;
 import org.apache.mnemonic.collections.DurableSinglyLinkedListFactory;
-import org.apache.mnemonic.service.memory.internal.PMemServiceImpl;
 
 import java.text.SimpleDateFormat;
 
@@ -32,7 +32,7 @@ public class CreateOrder {
   public static void main(String[] argv) throws Exception {
 
     /* create a non-volatile memory pool from one of memory services */
-    NonVolatileMemAllocator act = new NonVolatileMemAllocator(new PMemServiceImpl(),
+    NonVolatileMemAllocator act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"),
 
         1024L * 1024 * 1024, "./example_order.dat", true);
 
     System.out.printf("Creating Customer info...\n");
diff --git a/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/HelloWorld.java
b/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/HelloWorld.java
index dc2ca51..32ee9be 100644
--- a/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/HelloWorld.java
+++ b/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/HelloWorld.java
@@ -22,14 +22,13 @@ import org.apache.mnemonic.NonVolatileMemAllocator;
 import org.apache.mnemonic.Utils;
 import org.apache.mnemonic.collections.DurableString;
 import org.apache.mnemonic.collections.DurableStringFactory;
-import org.apache.mnemonic.service.memory.internal.PMemServiceImpl;
 
 public class HelloWorld {
 
   public static void main(String[] argv) throws Exception {
 
     /* create a non-volatile memory pool from one of memory services */
-    NonVolatileMemAllocator act = new NonVolatileMemAllocator(new PMemServiceImpl(),
+    NonVolatileMemAllocator act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"),
         1024L * 1024 * 1024, "./example_helloworld.dat", true);
 
     /* create durable string object */
diff --git a/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/Main.java b/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/Main.java
index 2f2a9c6..f9d73a5 100644
--- a/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/Main.java
+++ b/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/Main.java
@@ -28,8 +28,6 @@ import org.apache.mnemonic.MemClustering;
 import org.apache.mnemonic.Reclaim;
 import org.apache.mnemonic.SysMemAllocator;
 import org.apache.mnemonic.Utils;
-import org.apache.mnemonic.service.memory.internal.VMemServiceImpl;
-// import org.apache.mnemonic.service.memory.internal.PMemServiceImpl;
 
 import sun.misc.Unsafe;
 
@@ -67,8 +65,7 @@ public class Main {
         // true).disableActiveGC(),
         // MemClustering.PerformanceLevel.NORMAL),
         new MemClustering.NodeConfig(
-            new VolatileMemAllocator(new VMemServiceImpl(), 1024 * 1024 * 20, "."),
-            // new PMemServiceImpl(),
+            new VolatileMemAllocator(Utils.getVolatileMemoryAllocatorService("vmem"), 1024
* 1024 * 20, "."),
             // 1024 * 1024 * 20, "./example.dat", true),
             MemClustering.PerformanceLevel.SLOW), };
 
diff --git a/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/ShowOrder.java b/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/ShowOrder.java
index 505dcd6..a22c4af 100644
--- a/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/ShowOrder.java
+++ b/mnemonic-examples/src/main/java/org/apache/mnemonic/examples/ShowOrder.java
@@ -21,14 +21,14 @@ import org.apache.mnemonic.DurableType;
 import org.apache.mnemonic.EntityFactoryProxy;
 import org.apache.mnemonic.EntityFactoryProxyHelper;
 import org.apache.mnemonic.NonVolatileMemAllocator;
-import org.apache.mnemonic.service.memory.internal.PMemServiceImpl;
+import org.apache.mnemonic.Utils;
 
 public class ShowOrder {
 
   public static void main(String[] argv) throws Exception {
 
     /* create a non-volatile memory pool from one of memory services */
-    NonVolatileMemAllocator act = new NonVolatileMemAllocator(new PMemServiceImpl(),
+    NonVolatileMemAllocator act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"),
         1024L * 1024 * 1024, "./example_order.dat", false);
 
     DurableType listgftypes[] = {DurableType.DURABLE};


Mime
View raw message