http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/VMemServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/VMemServiceImpl.java
 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/VMemServiceImpl.java
deleted file mode 100644
index 00a2a39..0000000
--- 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/VMemServiceImpl.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.mnemonic.service.memoryservice.internal;
-
-import org.apache.mnemonic.service.memoryservice.MemoryServiceFeature;
-import 
org.apache.mnemonic.service.memoryservice.VolatileMemoryAllocatorService;
-import org.flowcomputing.commons.primitives.NativeLibraryLoader;
-
-import java.nio.ByteBuffer;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.HashSet;
-
-public class VMemServiceImpl implements VolatileMemoryAllocatorService {
-  static {
-    try {
-      NativeLibraryLoader.loadFromJar("vmemallocator");
-    } catch (Exception e) {
-      throw new Error(e);
-    }
-  }
-
-  protected Map<Long, Long> m_info = Collections.synchronizedMap(new 
HashMap<Long, Long>());
-
-  @Override
-  public String getServiceId() {
-    return "vmem";
-  }
-
-  @Override
-  public long init(long capacity, String uri, boolean isnew) {
-    long ret = ninit(capacity, uri, isnew);
-    m_info.put(ret, capacity);
-    return ret;
-  }
-
-  @Override
-  public long adjustCapacity(long id, long reserve) {
-    throw new UnsupportedOperationException("Unsupported to reduce capacity of 
this memory service");
-  }
-
-  @Override
-  public void close(long id) {
-    nclose(id);
-  }
-
-  @Override
-  public void sync(long id, long addr, long length, boolean autodetect) {
-    nsync(id, addr, length, autodetect);
-  }
-
-  @Override
-  public long capacity(long id) {
-    return m_info.get(id);
-  }
-
-  @Override
-  public long allocate(long id, long size, boolean initzero) {
-    return nallocate(id, size, initzero);
-  }
-
-  @Override
-  public long reallocate(long id, long addr, long size, boolean initzero) {
-    return nreallocate(id, addr, size, initzero);
-  }
-
-  @Override
-  public void free(long id, long addr) {
-    nfree(id, addr);
-  }
-
-  @Override
-  public ByteBuffer createByteBuffer(long id, long size) {
-    return ncreateByteBuffer(id, size);
-  }
-
-  @Override
-  public ByteBuffer resizeByteBuffer(long id, ByteBuffer bytebuf, long size) {
-    return nresizeByteBuffer(id, bytebuf, size);
-  }
-
-  @Override
-  public void destroyByteBuffer(long id, ByteBuffer bytebuf) {
-    ndestroyByteBuffer(id, bytebuf);
-  }
-
-  @Override
-  public ByteBuffer retrieveByteBuffer(long id, long handler) {
-    return nretrieveByteBuffer(id, handler);
-  }
-
-  @Override
-  public long retrieveSize(long id, long handler) {
-    return nretrieveSize(id, handler);
-  }
-
-  @Override
-  public long getByteBufferHandler(long id, ByteBuffer buf) {
-    return ngetByteBufferHandler(id, buf);
-  }
-
-  @Override
-  public void setHandler(long id, long key, long handler) {
-    nsetHandler(id, key, handler);
-  }
-
-  @Override
-  public long getHandler(long id, long key) {
-    return ngetHandler(id, key);
-  }
-
-  @Override
-  public long handlerCapacity(long id) {
-    return nhandlerCapacity(id);
-  }
-
-  @Override
-  public long getBaseAddress(long id) {
-    return 0L;
-    //return ngetBaseAddress(id);
-  }
-
-  @Override
-  public void beginTransaction(boolean readOnly) {
-    throw new UnsupportedOperationException("Not support transaction");
-  }
-
-  @Override
-  public void commitTransaction() {
-    throw new UnsupportedOperationException("Not support transaction");
-  }
-
-  @Override
-  public void abortTransaction() {
-    throw new UnsupportedOperationException("Not support transaction");
-  }
-
-  @Override
-  public boolean isInTransaction() {
-    throw new UnsupportedOperationException("Not support transaction");
-  }
-
-  @Override
-  public Set<MemoryServiceFeature> getFeatures() {
-    Set<MemoryServiceFeature> ret = new HashSet<MemoryServiceFeature>();
-    ret.add(MemoryServiceFeature.VOLATILE);
-    return ret;
-  }
-
-  protected native long ninit(long capacity, String uri, boolean isnew);
-
-  protected native void nclose(long id);
-
-  protected native void nsync(long id, long addr, long length, boolean 
autodetect);
-
-  protected native long ncapacity(long id);
-
-  protected native long nallocate(long id, long size, boolean initzero);
-
-  protected native long nreallocate(long id, long addr, long size, boolean 
initzero);
-
-  protected native void nfree(long id, long addr);
-
-  protected native ByteBuffer ncreateByteBuffer(long id, long size);
-
-  protected native ByteBuffer nresizeByteBuffer(long id, ByteBuffer bytebuf, 
long size);
-
-  protected native void ndestroyByteBuffer(long id, ByteBuffer bytebuf);
-
-  protected native ByteBuffer nretrieveByteBuffer(long id, long handler);
-
-  protected native long nretrieveSize(long id, long handler);
-
-  protected native long ngetByteBufferHandler(long id, ByteBuffer buf);
-
-  protected native void nsetHandler(long id, long key, long handler);
-
-  protected native long ngetHandler(long id, long key);
-
-  protected native long nhandlerCapacity(long id);
-
-  protected native long ngetBaseAddress(long id);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/CMakeLists.txt
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/CMakeLists.txt
 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/CMakeLists.txt
index 0611d6c..8aae0aa 100644
--- 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/CMakeLists.txt
+++ 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/CMakeLists.txt
@@ -43,7 +43,7 @@ if (NOT LIBVMEM_LIBRARIES)
    message(FATAL_ERROR "not found vmem library")
 endif (NOT LIBVMEM_LIBRARIES)
 
-add_library(vmemallocator SHARED common.c 
org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.c)
+add_library(vmemallocator SHARED common.c 
org_apache_mnemonic_service_memory_internal_VMemServiceImpl.c)
 target_include_directories(vmemallocator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
 target_link_libraries(vmemallocator ${LIBVMEM_LIBRARIES})
 

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memory_internal_VMemServiceImpl.c
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memory_internal_VMemServiceImpl.c
 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memory_internal_VMemServiceImpl.c
new file mode 100644
index 0000000..400464e
--- /dev/null
+++ 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memory_internal_VMemServiceImpl.c
@@ -0,0 +1,279 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "org_apache_mnemonic_service_memory_internal_VMemServiceImpl.h"
+
+static VMPool *g_vmpool_arr = NULL;
+static size_t g_vmpool_count = 0;
+
+static pthread_rwlock_t g_vmem_rwlock = PTHREAD_RWLOCK_INITIALIZER;
+
+/******************************************************************************
+ ** JNI implementations
+ *****************************************************************************/
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_nallocate(JNIEnv*
 env,
+    jobject this, jlong id, jlong size, jboolean initzero) {
+  VMPool *pool;
+  pthread_rwlock_rdlock(&g_vmem_rwlock);
+  pool = g_vmpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  void* nativebuf = vrealloc(pool, NULL, size, initzero);
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_vmem_rwlock);
+  return addr_to_java(nativebuf);
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_nreallocate(JNIEnv*
 env,
+    jobject this, jlong id, jlong addr, jlong size, jboolean initzero) {
+  VMPool *pool;
+  pthread_rwlock_rdlock(&g_vmem_rwlock);
+  pool = g_vmpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  void* p = addr_from_java(addr);
+  void* nativebuf = vrealloc(pool, p, size, initzero);
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_vmem_rwlock);
+  return addr_to_java(nativebuf);
+}
+
+JNIEXPORT
+void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_nfree(
+    JNIEnv* env,
+    jobject this, jlong id,
+    jlong addr) {
+  VMPool *pool;
+  pthread_rwlock_rdlock(&g_vmem_rwlock);
+  pool = g_vmpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  void* nativebuf = addr_from_java(addr);
+  vfree(pool, nativebuf);
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_vmem_rwlock);
+}
+
+JNIEXPORT
+void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_nsync(
+    JNIEnv* env,
+    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect)
+{
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_ncapacity(
+    JNIEnv* env,
+    jobject this, jlong id)
+{
+  VMPool *pool;
+  pool = g_vmpool_arr + id;
+  return pool->capacity;
+}
+
+JNIEXPORT
+jobject JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_ncreateByteBuffer(
+    JNIEnv *env, jobject this, jlong id, jlong size) {
+  VMPool *pool;
+  jobject ret = NULL;
+  pthread_rwlock_rdlock(&g_vmem_rwlock);
+  pool = g_vmpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  void* nativebuf = vrealloc(pool, NULL, size, 0);
+  ret = NULL != nativebuf ? (*env)->NewDirectByteBuffer(env, nativebuf, size) 
: NULL;
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_vmem_rwlock);
+  return ret;
+}
+
+JNIEXPORT
+jobject JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_nretrieveByteBuffer(
+    JNIEnv *env, jobject this, jlong id, jlong addr) {
+  jobject ret = NULL;
+  void* p = addr_from_java(addr);
+  if (NULL != p) {
+    void* nativebuf = p - PMBHSZ;
+    ret = (*env)->NewDirectByteBuffer(env, p, ((PMBHeader *) nativebuf)->size 
- PMBHSZ);
+  }
+  return ret;
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_nretrieveSize(JNIEnv
 *env,
+    jobject this, jlong id, jlong addr) {
+  VMPool *pool;
+  pthread_rwlock_rdlock(&g_vmem_rwlock);
+  pool = g_vmpool_arr + id;
+  void* p = addr_from_java(addr);
+  jlong ret = vsize(pool, p);
+  pthread_rwlock_unlock(&g_vmem_rwlock);
+  return ret;
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_ngetByteBufferHandler(
+    JNIEnv *env, jobject this, jlong id, jobject bytebuf) {
+//  fprintf(stderr, "ngetByteBufferAddress Get Called %X, %X\n", env, bytebuf);
+  jlong ret = 0L;
+  if (NULL != bytebuf) {
+    void* nativebuf = (*env)->GetDirectBufferAddress(env, bytebuf);
+//      fprintf(stderr, "ngetByteBufferAddress Get Native addr %X\n", 
nativebuf);
+    ret = addr_to_java(nativebuf);
+  }
+//    fprintf(stderr, "ngetByteBufferAddress returned addr %016lx\n", ret);
+  return ret;
+}
+
+JNIEXPORT
+jobject JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_nresizeByteBuffer(
+    JNIEnv *env, jobject this, jlong id, jobject bytebuf, jlong size) {
+  VMPool *pool;
+  jobject ret = NULL;
+  pthread_rwlock_rdlock(&g_vmem_rwlock);
+  pool = g_vmpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  if (NULL != bytebuf) {
+    void* nativebuf = (void*) (*env)->GetDirectBufferAddress(env, bytebuf);
+    if (nativebuf != NULL) {
+      nativebuf = vrealloc(pool, nativebuf, size, 0);
+      if (NULL != nativebuf) {
+        ret = (*env)->NewDirectByteBuffer(env, nativebuf, size);
+      }
+    }
+  }
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_vmem_rwlock);
+  return ret;
+}
+
+JNIEXPORT
+void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_ndestroyByteBuffer(
+    JNIEnv *env, jobject this, jlong id, jobject bytebuf) {
+  VMPool *pool;
+  pthread_rwlock_rdlock(&g_vmem_rwlock);
+  pool = g_vmpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  if (NULL != bytebuf) {
+    void* nativebuf = (*env)->GetDirectBufferAddress(env, bytebuf);
+    if (nativebuf != NULL) {
+      vfree(pool, nativebuf);
+    }
+  }
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_vmem_rwlock);
+}
+
+
+JNIEXPORT
+void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_nsetHandler(
+    JNIEnv *env, jobject this, jlong id, jlong key, jlong value)
+{
+  throw(env, "setkey()/getkey() temporarily not supported");
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_ngetHandler(JNIEnv
 *env,
+    jobject this, jlong id, jlong key) {
+  throw(env, "setkey()/getkey() temporarily not supported");
+  return 0;
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_nhandlerCapacity(
+    JNIEnv *env, jobject this) {
+  throw(env, "setkey()/getkey() temporarily not supported");
+  return 0;
+}
+
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_ngetBaseAddress(JNIEnv
 *env,
+    jobject this, jlong id) {
+  return 0L;
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_ninit(JNIEnv 
*env, jclass this,
+    jlong capacity, jstring pathname, jboolean isnew) {
+  pthread_rwlock_wrlock(&g_vmem_rwlock);
+  VMPool *pool;
+  size_t ret = -1;
+  VMEM *vmp = NULL;
+  const char* mpathname = (*env)->GetStringUTFChars(env, pathname, NULL);
+  if (NULL == mpathname) {
+    pthread_rwlock_unlock(&g_vmem_rwlock);
+    throw(env, "Big memory path not specified!");
+  }
+  if ((vmp = vmem_create(mpathname,
+       VMEM_MIN_POOL > capacity ? VMEM_MIN_POOL : capacity)) == NULL) {
+    pthread_rwlock_unlock(&g_vmem_rwlock);
+    throw(env, "Big memory init failure!");
+  }
+  g_vmpool_arr = realloc(g_vmpool_arr, (g_vmpool_count + 1) * sizeof(VMPool));
+  if (NULL != g_vmpool_arr) {
+    pool = g_vmpool_arr + g_vmpool_count;
+    pool->vmp = vmp;
+    pool->capacity = capacity;
+    pthread_mutex_init(&pool->mutex, NULL);
+    ret = g_vmpool_count;
+    g_vmpool_count++;
+  } else {
+    pthread_rwlock_unlock(&g_vmem_rwlock);
+    throw(env, "Big memory init Out of memory!");
+  }
+  pthread_rwlock_unlock(&g_vmem_rwlock);
+  return ret;
+}
+
+JNIEXPORT
+void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_nclose
+(JNIEnv *env, jobject this, jlong id)
+{
+  VMPool *pool;
+  pthread_rwlock_wrlock(&g_vmem_rwlock);
+  pool = g_vmpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  if (NULL != pool->vmp) {
+    pool->vmp = NULL;
+    pool->capacity = 0;
+  }
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_mutex_destroy(&pool->mutex);
+  pthread_rwlock_unlock(&g_vmem_rwlock);
+}
+
+__attribute__((destructor)) void fini(void) {
+  int i;
+  VMPool *pool;
+  pthread_rwlock_wrlock(&g_vmem_rwlock);
+  if (NULL != g_vmpool_arr) {
+    for (i = 0; i < g_vmpool_count; ++i) {
+      pool = g_vmpool_arr + i;
+      if (NULL != pool->vmp) {
+        pool->vmp = NULL;
+        pool->capacity = 0;
+        pthread_mutex_destroy(&pool->mutex);
+      }
+    }
+    free(g_vmpool_arr);
+    g_vmpool_arr = NULL;
+    g_vmpool_count = 0;
+  }
+  pthread_rwlock_unlock(&g_vmem_rwlock);
+  pthread_rwlock_destroy(&g_vmem_rwlock);
+}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memory_internal_VMemServiceImpl.h
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memory_internal_VMemServiceImpl.h
 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memory_internal_VMemServiceImpl.h
new file mode 100644
index 0000000..6bb3fb4
--- /dev/null
+++ 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memory_internal_VMemServiceImpl.h
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <jni.h>
+/* Header for class 
org_apache_mnemonic_service_memory_internal_VMemServiceImpl */
+
+#include "common.h"
+
+#ifndef _Included_org_apache_mnemonic_service_memory_internal_VMemServiceImpl
+#define _Included_org_apache_mnemonic_service_memory_internal_VMemServiceImpl
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     org_apache_mnemonic_service_memory_internal_VMemServiceImpl
+ * Method:    jniInit
+ * Signature: (II)V
+ */
+JNIEXPORT void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_jniInit
+(JNIEnv *, jobject, jint, jint);
+
+/*
+ * Class:     org_apache_mnemonic_service_memory_internal_VMemServiceImpl
+ * Method:    jniTerm
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_VMemServiceImpl_jniTerm
+(JNIEnv *, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.c
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.c
 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.c
deleted file mode 100644
index 63ffe4c..0000000
--- 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.h"
-
-static VMPool *g_vmpool_arr = NULL;
-static size_t g_vmpool_count = 0;
-
-static pthread_rwlock_t g_vmem_rwlock = PTHREAD_RWLOCK_INITIALIZER;
-
-/******************************************************************************
- ** JNI implementations
- *****************************************************************************/
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nallocate(JNIEnv*
 env,
-    jobject this, jlong id, jlong size, jboolean initzero) {
-  VMPool *pool;
-  pthread_rwlock_rdlock(&g_vmem_rwlock);
-  pool = g_vmpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  void* nativebuf = vrealloc(pool, NULL, size, initzero);
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_vmem_rwlock);
-  return addr_to_java(nativebuf);
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nreallocate(JNIEnv*
 env,
-    jobject this, jlong id, jlong addr, jlong size, jboolean initzero) {
-  VMPool *pool;
-  pthread_rwlock_rdlock(&g_vmem_rwlock);
-  pool = g_vmpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  void* p = addr_from_java(addr);
-  void* nativebuf = vrealloc(pool, p, size, initzero);
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_vmem_rwlock);
-  return addr_to_java(nativebuf);
-}
-
-JNIEXPORT
-void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nfree(
-    JNIEnv* env,
-    jobject this, jlong id,
-    jlong addr) {
-  VMPool *pool;
-  pthread_rwlock_rdlock(&g_vmem_rwlock);
-  pool = g_vmpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  void* nativebuf = addr_from_java(addr);
-  vfree(pool, nativebuf);
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_vmem_rwlock);
-}
-
-JNIEXPORT
-void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nsync(
-    JNIEnv* env,
-    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect)
-{
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_ncapacity(
-    JNIEnv* env,
-    jobject this, jlong id)
-{
-  VMPool *pool;
-  pool = g_vmpool_arr + id;
-  return pool->capacity;
-}
-
-JNIEXPORT
-jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_ncreateByteBuffer(
-    JNIEnv *env, jobject this, jlong id, jlong size) {
-  VMPool *pool;
-  jobject ret = NULL;
-  pthread_rwlock_rdlock(&g_vmem_rwlock);
-  pool = g_vmpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  void* nativebuf = vrealloc(pool, NULL, size, 0);
-  ret = NULL != nativebuf ? (*env)->NewDirectByteBuffer(env, nativebuf, size) 
: NULL;
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_vmem_rwlock);
-  return ret;
-}
-
-JNIEXPORT
-jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nretrieveByteBuffer(
-    JNIEnv *env, jobject this, jlong id, jlong addr) {
-  jobject ret = NULL;
-  void* p = addr_from_java(addr);
-  if (NULL != p) {
-    void* nativebuf = p - PMBHSZ;
-    ret = (*env)->NewDirectByteBuffer(env, p, ((PMBHeader *) nativebuf)->size 
- PMBHSZ);
-  }
-  return ret;
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nretrieveSize(JNIEnv
 *env,
-    jobject this, jlong id, jlong addr) {
-  VMPool *pool;
-  pthread_rwlock_rdlock(&g_vmem_rwlock);
-  pool = g_vmpool_arr + id;
-  void* p = addr_from_java(addr);
-  jlong ret = vsize(pool, p);
-  pthread_rwlock_unlock(&g_vmem_rwlock);
-  return ret;
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_ngetByteBufferHandler(
-    JNIEnv *env, jobject this, jlong id, jobject bytebuf) {
-//  fprintf(stderr, "ngetByteBufferAddress Get Called %X, %X\n", env, bytebuf);
-  jlong ret = 0L;
-  if (NULL != bytebuf) {
-    void* nativebuf = (*env)->GetDirectBufferAddress(env, bytebuf);
-//      fprintf(stderr, "ngetByteBufferAddress Get Native addr %X\n", 
nativebuf);
-    ret = addr_to_java(nativebuf);
-  }
-//    fprintf(stderr, "ngetByteBufferAddress returned addr %016lx\n", ret);
-  return ret;
-}
-
-JNIEXPORT
-jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nresizeByteBuffer(
-    JNIEnv *env, jobject this, jlong id, jobject bytebuf, jlong size) {
-  VMPool *pool;
-  jobject ret = NULL;
-  pthread_rwlock_rdlock(&g_vmem_rwlock);
-  pool = g_vmpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  if (NULL != bytebuf) {
-    void* nativebuf = (void*) (*env)->GetDirectBufferAddress(env, bytebuf);
-    if (nativebuf != NULL) {
-      nativebuf = vrealloc(pool, nativebuf, size, 0);
-      if (NULL != nativebuf) {
-        ret = (*env)->NewDirectByteBuffer(env, nativebuf, size);
-      }
-    }
-  }
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_vmem_rwlock);
-  return ret;
-}
-
-JNIEXPORT
-void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_ndestroyByteBuffer(
-    JNIEnv *env, jobject this, jlong id, jobject bytebuf) {
-  VMPool *pool;
-  pthread_rwlock_rdlock(&g_vmem_rwlock);
-  pool = g_vmpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  if (NULL != bytebuf) {
-    void* nativebuf = (*env)->GetDirectBufferAddress(env, bytebuf);
-    if (nativebuf != NULL) {
-      vfree(pool, nativebuf);
-    }
-  }
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_vmem_rwlock);
-}
-
-
-JNIEXPORT
-void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nsetHandler(
-    JNIEnv *env, jobject this, jlong id, jlong key, jlong value)
-{
-  throw(env, "setkey()/getkey() temporarily not supported");
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_ngetHandler(JNIEnv
 *env,
-    jobject this, jlong id, jlong key) {
-  throw(env, "setkey()/getkey() temporarily not supported");
-  return 0;
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nhandlerCapacity(
-    JNIEnv *env, jobject this) {
-  throw(env, "setkey()/getkey() temporarily not supported");
-  return 0;
-}
-
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_ngetBaseAddress(JNIEnv
 *env,
-    jobject this, jlong id) {
-  return 0L;
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_ninit(JNIEnv
 *env, jclass this,
-    jlong capacity, jstring pathname, jboolean isnew) {
-  pthread_rwlock_wrlock(&g_vmem_rwlock);
-  VMPool *pool;
-  size_t ret = -1;
-  VMEM *vmp = NULL;
-  const char* mpathname = (*env)->GetStringUTFChars(env, pathname, NULL);
-  if (NULL == mpathname) {
-    pthread_rwlock_unlock(&g_vmem_rwlock);
-    throw(env, "Big memory path not specified!");
-  }
-  if ((vmp = vmem_create(mpathname,
-       VMEM_MIN_POOL > capacity ? VMEM_MIN_POOL : capacity)) == NULL) {
-    pthread_rwlock_unlock(&g_vmem_rwlock);
-    throw(env, "Big memory init failure!");
-  }
-  g_vmpool_arr = realloc(g_vmpool_arr, (g_vmpool_count + 1) * sizeof(VMPool));
-  if (NULL != g_vmpool_arr) {
-    pool = g_vmpool_arr + g_vmpool_count;
-    pool->vmp = vmp;
-    pool->capacity = capacity;
-    pthread_mutex_init(&pool->mutex, NULL);
-    ret = g_vmpool_count;
-    g_vmpool_count++;
-  } else {
-    pthread_rwlock_unlock(&g_vmem_rwlock);
-    throw(env, "Big memory init Out of memory!");
-  }
-  pthread_rwlock_unlock(&g_vmem_rwlock);
-  return ret;
-}
-
-JNIEXPORT
-void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_nclose
-(JNIEnv *env, jobject this, jlong id)
-{
-  VMPool *pool;
-  pthread_rwlock_wrlock(&g_vmem_rwlock);
-  pool = g_vmpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  if (NULL != pool->vmp) {
-    pool->vmp = NULL;
-    pool->capacity = 0;
-  }
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_mutex_destroy(&pool->mutex);
-  pthread_rwlock_unlock(&g_vmem_rwlock);
-}
-
-__attribute__((destructor)) void fini(void) {
-  int i;
-  VMPool *pool;
-  pthread_rwlock_wrlock(&g_vmem_rwlock);
-  if (NULL != g_vmpool_arr) {
-    for (i = 0; i < g_vmpool_count; ++i) {
-      pool = g_vmpool_arr + i;
-      if (NULL != pool->vmp) {
-        pool->vmp = NULL;
-        pool->capacity = 0;
-        pthread_mutex_destroy(&pool->mutex);
-      }
-    }
-    free(g_vmpool_arr);
-    g_vmpool_arr = NULL;
-    g_vmpool_count = 0;
-  }
-  pthread_rwlock_unlock(&g_vmem_rwlock);
-  pthread_rwlock_destroy(&g_vmem_rwlock);
-}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.h
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.h
 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.h
deleted file mode 100644
index b06e7b4..0000000
--- 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <jni.h>
-/* Header for class 
org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl */
-
-#include "common.h"
-
-#ifndef 
_Included_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl
-#define 
_Included_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class:     
org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl
- * Method:    jniInit
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_jniInit
-(JNIEnv *, jobject, jint, jint);
-
-/*
- * Class:     
org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl
- * Method:    jniTerm
- * Signature: ()V
- */
-JNIEXPORT void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_VMemServiceImpl_jniTerm
-(JNIEnv *, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService
 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService
new file mode 100644
index 0000000..fa41419
--- /dev/null
+++ 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.VolatileMemoryAllocatorService
@@ -0,0 +1 @@
+org.apache.mnemonic.service.memory.internal.VMemServiceImpl

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memoryservice.VolatileMemoryAllocatorService
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memoryservice.VolatileMemoryAllocatorService
 
b/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memoryservice.VolatileMemoryAllocatorService
deleted file mode 100644
index e9ff8a6..0000000
--- 
a/mnemonic-memory-services/mnemonic-nvml-vmem-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memoryservice.VolatileMemoryAllocatorService
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.mnemonic.service.memoryservice.internal.VMemServiceImpl

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/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
new file mode 100644
index 0000000..f579a82
--- /dev/null
+++ 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memory/internal/PMallocServiceImpl.java
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mnemonic.service.memory.internal;
+
+import org.apache.mnemonic.service.memory.MemoryServiceFeature;
+import org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService;
+import org.flowcomputing.commons.primitives.NativeLibraryLoader;
+
+import java.nio.ByteBuffer;
+import java.util.HashSet;
+import java.util.Set;
+
+public class PMallocServiceImpl implements NonVolatileMemoryAllocatorService {
+  static {
+    try {
+      NativeLibraryLoader.loadFromJar("pmallocallocator");
+    } catch (Exception e) {
+      throw new Error(e);
+    }
+  }
+
+  @Override
+  public String getServiceId() {
+    return "pmalloc";
+  }
+
+  @Override
+  public long init(long capacity, String uri, boolean isnew) {
+    return ninit(capacity, uri, isnew);
+  }
+
+  @Override
+  public long adjustCapacity(long id, long reserve) {
+    throw new UnsupportedOperationException("Unsupported to reduce capacity of 
this memory service");
+  }
+
+  @Override
+  public void close(long id) {
+    nclose(id);
+  }
+
+  @Override
+  public void sync(long id, long addr, long length, boolean autodetect) {
+    nsync(id, addr, length, autodetect);
+  }
+
+  @Override
+  public long capacity(long id) {
+    return ncapacity(id);
+  }
+
+  @Override
+  public long allocate(long id, long size, boolean initzero) {
+    return nallocate(id, size, initzero);
+  }
+
+  @Override
+  public long reallocate(long id, long addr, long size, boolean initzero) {
+    return nreallocate(id, addr, size, initzero);
+  }
+
+  @Override
+  public void free(long id, long addr) {
+    nfree(id, addr);
+  }
+
+  @Override
+  public ByteBuffer createByteBuffer(long id, long size) {
+    return ncreateByteBuffer(id, size);
+  }
+
+  @Override
+  public ByteBuffer resizeByteBuffer(long id, ByteBuffer bytebuf, long size) {
+    return nresizeByteBuffer(id, bytebuf, size);
+  }
+
+  @Override
+  public void destroyByteBuffer(long id, ByteBuffer bytebuf) {
+    ndestroyByteBuffer(id, bytebuf);
+  }
+
+  @Override
+  public ByteBuffer retrieveByteBuffer(long id, long handler) {
+    return nretrieveByteBuffer(id, handler);
+  }
+
+  @Override
+  public long retrieveSize(long id, long handler) {
+    return nretrieveSize(id, handler);
+  }
+
+  @Override
+  public long getByteBufferHandler(long id, ByteBuffer buf) {
+    return ngetByteBufferHandler(id, buf);
+  }
+
+  @Override
+  public void setHandler(long id, long key, long handler) {
+    nsetHandler(id, key, handler);
+  }
+
+  @Override
+  public long getHandler(long id, long key) {
+    return ngetHandler(id, key);
+  }
+
+  @Override
+  public long handlerCapacity(long id) {
+    return nhandlerCapacity(id);
+  }
+
+  @Override
+  public void persist(long id, long addr, long length, boolean autodetect) {
+    npersist(id, addr, length, autodetect);
+  }
+
+  @Override
+  public void flush(long id, long addr, long length, boolean autodetect) {
+    nflush(id, addr, length, autodetect);
+  }
+
+  @Override
+  public void drain(long id) {
+    ndrain(id);
+  }
+
+  @Override
+  public long getBaseAddress(long id) {
+    return ngetBaseAddress(id);
+  }
+
+  @Override
+  public void beginTransaction(boolean readOnly) {
+    throw new UnsupportedOperationException("Not support transaction");
+  }
+
+  @Override
+  public void commitTransaction() {
+    throw new UnsupportedOperationException("Not support transaction");
+  }
+
+  @Override
+  public void abortTransaction() {
+    throw new UnsupportedOperationException("Not support transaction");
+  }
+
+  @Override
+  public boolean isInTransaction() {
+    throw new UnsupportedOperationException("Not support transaction");
+  }
+
+  @Override
+  public Set<MemoryServiceFeature> getFeatures() {
+    Set<MemoryServiceFeature> ret = new HashSet<MemoryServiceFeature>();
+    ret.add(MemoryServiceFeature.VOLATILE);
+    ret.add(MemoryServiceFeature.NONVOLATILE);
+    return ret;
+  }
+
+  protected native long ninit(long capacity, String uri, boolean isnew);
+
+  protected native void nclose(long id);
+
+  protected native void nsync(long id, long addr, long length, boolean 
autodetect);
+
+  protected native long ncapacity(long id);
+
+  protected native long nallocate(long id, long size, boolean initzero);
+
+  protected native long nreallocate(long id, long addr, long size, boolean 
initzero);
+
+  protected native void nfree(long id, long addr);
+
+  protected native ByteBuffer ncreateByteBuffer(long id, long size);
+
+  protected native ByteBuffer nresizeByteBuffer(long id, ByteBuffer bytebuf, 
long size);
+
+  protected native void ndestroyByteBuffer(long id, ByteBuffer bytebuf);
+
+  protected native ByteBuffer nretrieveByteBuffer(long id, long handler);
+
+  protected native long nretrieveSize(long id, long handler);
+
+  protected native long ngetByteBufferHandler(long id, ByteBuffer buf);
+
+  protected native void nsetHandler(long id, long key, long handler);
+
+  protected native long ngetHandler(long id, long key);
+
+  protected native long nhandlerCapacity(long id);
+
+  protected native void npersist(long id, long addr, long length, boolean 
autodetect);
+
+  protected native void nflush(long id, long addr, long length, boolean 
autodetect);
+
+  protected native void ndrain(long id);
+
+  protected native long ngetBaseAddress(long id);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMallocServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMallocServiceImpl.java
 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMallocServiceImpl.java
deleted file mode 100644
index e6faf4b..0000000
--- 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/java/org/apache/mnemonic/service/memoryservice/internal/PMallocServiceImpl.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.mnemonic.service.memoryservice.internal;
-
-import org.apache.mnemonic.service.memoryservice.MemoryServiceFeature;
-import 
org.apache.mnemonic.service.memoryservice.NonVolatileMemoryAllocatorService;
-import org.flowcomputing.commons.primitives.NativeLibraryLoader;
-
-import java.nio.ByteBuffer;
-import java.util.HashSet;
-import java.util.Set;
-
-public class PMallocServiceImpl implements NonVolatileMemoryAllocatorService {
-  static {
-    try {
-      NativeLibraryLoader.loadFromJar("pmallocallocator");
-    } catch (Exception e) {
-      throw new Error(e);
-    }
-  }
-
-  @Override
-  public String getServiceId() {
-    return "pmalloc";
-  }
-
-  @Override
-  public long init(long capacity, String uri, boolean isnew) {
-    return ninit(capacity, uri, isnew);
-  }
-
-  @Override
-  public long adjustCapacity(long id, long reserve) {
-    throw new UnsupportedOperationException("Unsupported to reduce capacity of 
this memory service");
-  }
-
-  @Override
-  public void close(long id) {
-    nclose(id);
-  }
-
-  @Override
-  public void sync(long id, long addr, long length, boolean autodetect) {
-    nsync(id, addr, length, autodetect);
-  }
-
-  @Override
-  public long capacity(long id) {
-    return ncapacity(id);
-  }
-
-  @Override
-  public long allocate(long id, long size, boolean initzero) {
-    return nallocate(id, size, initzero);
-  }
-
-  @Override
-  public long reallocate(long id, long addr, long size, boolean initzero) {
-    return nreallocate(id, addr, size, initzero);
-  }
-
-  @Override
-  public void free(long id, long addr) {
-    nfree(id, addr);
-  }
-
-  @Override
-  public ByteBuffer createByteBuffer(long id, long size) {
-    return ncreateByteBuffer(id, size);
-  }
-
-  @Override
-  public ByteBuffer resizeByteBuffer(long id, ByteBuffer bytebuf, long size) {
-    return nresizeByteBuffer(id, bytebuf, size);
-  }
-
-  @Override
-  public void destroyByteBuffer(long id, ByteBuffer bytebuf) {
-    ndestroyByteBuffer(id, bytebuf);
-  }
-
-  @Override
-  public ByteBuffer retrieveByteBuffer(long id, long handler) {
-    return nretrieveByteBuffer(id, handler);
-  }
-
-  @Override
-  public long retrieveSize(long id, long handler) {
-    return nretrieveSize(id, handler);
-  }
-
-  @Override
-  public long getByteBufferHandler(long id, ByteBuffer buf) {
-    return ngetByteBufferHandler(id, buf);
-  }
-
-  @Override
-  public void setHandler(long id, long key, long handler) {
-    nsetHandler(id, key, handler);
-  }
-
-  @Override
-  public long getHandler(long id, long key) {
-    return ngetHandler(id, key);
-  }
-
-  @Override
-  public long handlerCapacity(long id) {
-    return nhandlerCapacity(id);
-  }
-
-  @Override
-  public void persist(long id, long addr, long length, boolean autodetect) {
-    npersist(id, addr, length, autodetect);
-  }
-
-  @Override
-  public void flush(long id, long addr, long length, boolean autodetect) {
-    nflush(id, addr, length, autodetect);
-  }
-
-  @Override
-  public void drain(long id) {
-    ndrain(id);
-  }
-
-  @Override
-  public long getBaseAddress(long id) {
-    return ngetBaseAddress(id);
-  }
-
-  @Override
-  public void beginTransaction(boolean readOnly) {
-    throw new UnsupportedOperationException("Not support transaction");
-  }
-
-  @Override
-  public void commitTransaction() {
-    throw new UnsupportedOperationException("Not support transaction");
-  }
-
-  @Override
-  public void abortTransaction() {
-    throw new UnsupportedOperationException("Not support transaction");
-  }
-
-  @Override
-  public boolean isInTransaction() {
-    throw new UnsupportedOperationException("Not support transaction");
-  }
-
-  @Override
-  public Set<MemoryServiceFeature> getFeatures() {
-    Set<MemoryServiceFeature> ret = new HashSet<MemoryServiceFeature>();
-    ret.add(MemoryServiceFeature.VOLATILE);
-    ret.add(MemoryServiceFeature.NONVOLATILE);
-    return ret;
-  }
-
-  protected native long ninit(long capacity, String uri, boolean isnew);
-
-  protected native void nclose(long id);
-
-  protected native void nsync(long id, long addr, long length, boolean 
autodetect);
-
-  protected native long ncapacity(long id);
-
-  protected native long nallocate(long id, long size, boolean initzero);
-
-  protected native long nreallocate(long id, long addr, long size, boolean 
initzero);
-
-  protected native void nfree(long id, long addr);
-
-  protected native ByteBuffer ncreateByteBuffer(long id, long size);
-
-  protected native ByteBuffer nresizeByteBuffer(long id, ByteBuffer bytebuf, 
long size);
-
-  protected native void ndestroyByteBuffer(long id, ByteBuffer bytebuf);
-
-  protected native ByteBuffer nretrieveByteBuffer(long id, long handler);
-
-  protected native long nretrieveSize(long id, long handler);
-
-  protected native long ngetByteBufferHandler(long id, ByteBuffer buf);
-
-  protected native void nsetHandler(long id, long key, long handler);
-
-  protected native long ngetHandler(long id, long key);
-
-  protected native long nhandlerCapacity(long id);
-
-  protected native void npersist(long id, long addr, long length, boolean 
autodetect);
-
-  protected native void nflush(long id, long addr, long length, boolean 
autodetect);
-
-  protected native void ndrain(long id);
-
-  protected native long ngetBaseAddress(long id);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/CMakeLists.txt
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/CMakeLists.txt
 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/CMakeLists.txt
index 7f6c195..2942044 100644
--- 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/CMakeLists.txt
+++ 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/CMakeLists.txt
@@ -45,7 +45,7 @@ if (NOT LIBPMALLOC_LIBRARIES)
    message(FATAL_ERROR "not found pmalloc library")
 endif (NOT LIBPMALLOC_LIBRARIES)
 
-add_library(pmallocallocator SHARED common.c 
org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.c)
+add_library(pmallocallocator SHARED common.c 
org_apache_mnemonic_service_memory_internal_PMallocServiceImpl.c)
 target_include_directories(pmallocallocator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
 target_link_libraries(pmallocallocator ${LIBPMALLOC_LIBRARIES})
 

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memory_internal_PMallocServiceImpl.c
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memory_internal_PMallocServiceImpl.c
 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memory_internal_PMallocServiceImpl.c
new file mode 100644
index 0000000..3b022b9
--- /dev/null
+++ 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memory_internal_PMallocServiceImpl.c
@@ -0,0 +1,378 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "org_apache_mnemonic_service_memory_internal_PMallocServiceImpl.h"
+
+static PMALPool *g_pmalpool_arr = NULL;
+static size_t g_pmalpool_count = 0;
+
+static pthread_rwlock_t g_pmalp_rwlock = PTHREAD_RWLOCK_INITIALIZER;
+
+/******************************************************************************
+ ** JNI implementations
+ *****************************************************************************/
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_nallocate(JNIEnv*
 env,
+    jobject this, jlong id, jlong size, jboolean initzero) {
+  PMALPool *pool;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  void* nativebuf = pmalrealloc(pool, NULL, size, initzero);
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+  return addr_to_java(nativebuf);
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_nreallocate(JNIEnv*
 env,
+    jobject this, jlong id, jlong addr, jlong size, jboolean initzero) {
+  PMALPool *pool;
+  void* nativebuf = NULL;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  void* p = addr_from_java(addr);
+  nativebuf = pmalrealloc(pool, p, size, initzero);
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+  return addr_to_java(nativebuf);
+}
+
+JNIEXPORT
+void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_nfree(
+    JNIEnv* env,
+    jobject this, jlong id,
+    jlong addr) {
+  PMALPool *pool;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  void* nativebuf = addr_from_java(addr);
+  pmalfree(pool, nativebuf);
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+}
+
+JNIEXPORT
+void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_nsync(
+    JNIEnv* env,
+    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect) {
+  PMALPool *pool;
+  void *nativebuf;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  void *p = addr_from_java(addr);
+  if (autodetect) {
+    if (NULL != p) {
+      nativebuf = p - PMBHSZ;
+      pmsync(pool->pmp, nativebuf, ((PMBHeader *) nativebuf)->size);
+    } else {
+      pmsync(pool->pmp, b_addr(pool->pmp), pool->capacity);
+    }
+  } else {
+    if (NULL != p && len > 0L) {
+      pmsync(pool->pmp, p, len);
+    }
+  }
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+}
+
+JNIEXPORT
+void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_npersist(
+    JNIEnv* env,
+    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect) {
+  PMALPool *pool;
+  void *nativebuf;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  void *p = addr_from_java(addr);
+  if (autodetect) {
+    if (NULL != p) {
+      nativebuf = p - PMBHSZ;
+      pmsync(pool->pmp, nativebuf, ((PMBHeader *) nativebuf)->size);
+    } else {
+      pmsync(pool->pmp, b_addr(pool->pmp), pool->capacity);
+    }
+  } else {
+    if (NULL != p && len > 0L) {
+      pmsync(pool->pmp, p, len);
+    }
+  }
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+}
+
+JNIEXPORT
+void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_nflush(
+    JNIEnv* env,
+    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect) {
+  PMALPool *pool;
+  void *nativebuf;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  void *p = addr_from_java(addr);
+  if (autodetect) {
+    if (NULL != p) {
+      nativebuf = p - PMBHSZ;
+      pmsync(pool->pmp, nativebuf, ((PMBHeader *) nativebuf)->size);
+    } else {
+      pmsync(pool->pmp, b_addr(pool->pmp), pool->capacity);
+    }
+  } else {
+    if (NULL != p && len > 0L) {
+      pmsync(pool->pmp, p, len);
+    }
+  }
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+}
+
+JNIEXPORT
+void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_ndrain(
+    JNIEnv* env,
+    jobject this, jlong id)
+{
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_ncapacity(
+    JNIEnv* env,
+    jobject this, jlong id) {
+  PMALPool *pool;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  jlong ret = pool->capacity;
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+  return ret;
+}
+
+JNIEXPORT
+jobject JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_ncreateByteBuffer(
+    JNIEnv *env, jobject this, jlong id, jlong size) {
+  PMALPool *pool;
+  jobject ret = NULL;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  void* nativebuf = pmalrealloc(pool, NULL, size, 0);
+  if (NULL != nativebuf) {
+    ret = (*env)->NewDirectByteBuffer(env, nativebuf, size);
+  }
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+  return ret;
+}
+
+JNIEXPORT
+jobject JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_nretrieveByteBuffer(
+    JNIEnv *env, jobject this, jlong id, jlong addr) {
+  jobject ret = NULL;
+  void* p = addr_from_java(addr);
+  if (NULL != p) {
+    void* nativebuf = p - PMBHSZ;
+    ret = (*env)->NewDirectByteBuffer(env, p, ((PMBHeader *) nativebuf)->size 
- PMBHSZ);
+  }
+  return ret;
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_nretrieveSize(JNIEnv
 *env,
+    jobject this, jlong id, jlong addr) {
+  PMALPool *pool;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  void* p = addr_from_java(addr);
+  jlong ret = pmalsize(pool, p);
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+  return ret;
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_ngetByteBufferHandler(
+    JNIEnv *env, jobject this, jlong id, jobject bytebuf) {
+//     fprintf(stderr, "ngetByteBufferAddress Get Called %X, %X\n", env, 
bytebuf);
+  jlong ret = 0L;
+  if (NULL != bytebuf) {
+    void* nativebuf = (*env)->GetDirectBufferAddress(env, bytebuf);
+//     fprintf(stderr, "ngetByteBufferAddress Get Native addr %X\n", 
nativebuf);
+    ret = addr_to_java(nativebuf);
+  }
+//    fprintf(stderr, "ngetByteBufferAddress returned addr %016lx\n", ret);
+  return ret;
+}
+
+JNIEXPORT
+jobject JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_nresizeByteBuffer(
+    JNIEnv *env, jobject this, jlong id, jobject bytebuf, jlong size) {
+  PMALPool *pool;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  jobject ret = NULL;
+  if (NULL != bytebuf) {
+    void* nativebuf = (*env)->GetDirectBufferAddress(env, bytebuf);
+    if (nativebuf != NULL) {
+      nativebuf = pmalrealloc(pool, nativebuf, size, 0);
+      if (NULL != nativebuf) {
+        ret = (*env)->NewDirectByteBuffer(env, nativebuf, size);
+      }
+    }
+  }
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+  return ret;
+}
+
+JNIEXPORT
+void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_ndestroyByteBuffer(
+    JNIEnv *env, jobject this, jlong id, jobject bytebuf) {
+  PMALPool *pool;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  if (NULL != bytebuf) {
+    void* nativebuf = (*env)->GetDirectBufferAddress(env, bytebuf);
+    pmalfree(pool, nativebuf);
+  }
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+}
+
+JNIEXPORT
+void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_nsetHandler(
+    JNIEnv *env, jobject this, jlong id, jlong key, jlong value) {
+  PMALPool *pool;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  if (key < PMALLOC_KEYS && key >= 0) {
+    pmalloc_setkey(pool->pmp, key, (void*)value);
+  }
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_ngetHandler(JNIEnv
 *env,
+    jobject this, jlong id, jlong key) {
+  PMALPool *pool;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  jlong ret = (key < PMALLOC_KEYS && key >= 0) ? (long) 
pmalloc_getkey(pool->pmp, key) : 0;
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+  return ret;
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_nhandlerCapacity(
+    JNIEnv *env, jobject this) {
+  return PMALLOC_KEYS;
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_ngetBaseAddress(JNIEnv
 *env,
+    jobject this, jlong id) {
+  PMALPool *pool;
+  pthread_rwlock_rdlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  jlong ret = (long) b_addr(pool->pmp);
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+  return ret;
+}
+
+JNIEXPORT
+jlong JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_ninit(JNIEnv
 *env,
+    jclass this, jlong capacity, jstring pathname, jboolean isnew) {
+  PMALPool *pool;
+  size_t ret = -1;
+  void *md = NULL;
+  pthread_rwlock_wrlock(&g_pmalp_rwlock);
+  const char* mpathname = (*env)->GetStringUTFChars(env, pathname, NULL);
+  if (NULL == mpathname) {
+    pthread_rwlock_unlock(&g_pmalp_rwlock);
+    throw(env, "Big memory path not specified!");
+  }
+  int needcreate = access(mpathname, F_OK);
+  if (isnew && !needcreate) {
+    if(0 != unlink(mpathname)) {
+      throw(env, "Failure to delete file to create new one.");
+    }
+  }
+  if ((md = pmopen(mpathname, NULL,
+                   PMALLOC_MIN_POOL_SIZE > capacity ? PMALLOC_MIN_POOL_SIZE : 
capacity)) == NULL) {
+    pthread_rwlock_unlock(&g_pmalp_rwlock);
+    throw(env, "Big memory init failure!");
+  }
+  (*env)->ReleaseStringUTFChars(env, pathname, mpathname);
+  g_pmalpool_arr = realloc(g_pmalpool_arr, (g_pmalpool_count + 1) * 
sizeof(PMALPool));
+  if (NULL != g_pmalpool_arr) {
+    pool = g_pmalpool_arr + g_pmalpool_count;
+    pool->pmp = md;
+    pool->capacity = pmcapacity(pool->pmp);
+    pthread_mutex_init(&pool->mutex, NULL);
+    ret = g_pmalpool_count;
+    ++g_pmalpool_count;
+  } else {
+    pthread_rwlock_unlock(&g_pmalp_rwlock);
+    throw(env, "Big memory init Out of memory!");
+  }
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+  return ret;
+}
+
+JNIEXPORT
+void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_nclose
+(JNIEnv *env, jobject this, jlong id)
+{
+  PMALPool *pool;
+  pthread_rwlock_wrlock(&g_pmalp_rwlock);
+  pool = g_pmalpool_arr + id;
+  pthread_mutex_lock(&pool->mutex);
+  if (NULL != pool->pmp) {
+    pmclose(pool->pmp);
+    pool->pmp = NULL;
+    pool->capacity = 0;
+  }
+  pthread_mutex_unlock(&pool->mutex);
+  pthread_mutex_destroy(&pool->mutex);
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+}
+
+__attribute__((destructor)) void fini(void) {
+  int i;
+  PMALPool *pool;
+  pthread_rwlock_wrlock(&g_pmalp_rwlock);
+  if (NULL != g_pmalpool_arr) {
+    for (i = 0; i < g_pmalpool_count; ++i) {
+      pool = g_pmalpool_arr + i;
+      if (NULL != pool->pmp) {
+        pmclose(pool->pmp);
+        pool->pmp = NULL;
+        pool->capacity = 0;
+        pthread_mutex_destroy(&pool->mutex);
+      }
+    }
+    free(g_pmalpool_arr);
+    g_pmalpool_arr = NULL;
+    g_pmalpool_count = 0;
+  }
+  pthread_rwlock_unlock(&g_pmalp_rwlock);
+  pthread_rwlock_destroy(&g_pmalp_rwlock);
+}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memory_internal_PMallocServiceImpl.h
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memory_internal_PMallocServiceImpl.h
 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memory_internal_PMallocServiceImpl.h
new file mode 100644
index 0000000..d08f5a4
--- /dev/null
+++ 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memory_internal_PMallocServiceImpl.h
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <jni.h>
+/* Header for class PMallocServiceImpl */
+
+#include "common.h"
+
+#ifndef 
_Included_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl
+#define 
_Included_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     org_apache_mnemonic_service_memory_internal_PMallocServiceImpl
+ * Method:    jniInit
+ * Signature: (II)V
+ */
+JNIEXPORT void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_jniInit
+(JNIEnv *, jobject, jint, jint);
+
+/*
+ * Class:     org_apache_mnemonic_service_memory_internal_PMallocServiceImpl
+ * Method:    jniTerm
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL 
Java_org_apache_mnemonic_service_memory_internal_PMallocServiceImpl_jniTerm
+(JNIEnv *, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.c
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.c
 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.c
deleted file mode 100644
index 4b5be25..0000000
--- 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include 
"org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.h"
-
-static PMALPool *g_pmalpool_arr = NULL;
-static size_t g_pmalpool_count = 0;
-
-static pthread_rwlock_t g_pmalp_rwlock = PTHREAD_RWLOCK_INITIALIZER;
-
-/******************************************************************************
- ** JNI implementations
- *****************************************************************************/
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nallocate(JNIEnv*
 env,
-    jobject this, jlong id, jlong size, jboolean initzero) {
-  PMALPool *pool;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  void* nativebuf = pmalrealloc(pool, NULL, size, initzero);
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-  return addr_to_java(nativebuf);
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nreallocate(JNIEnv*
 env,
-    jobject this, jlong id, jlong addr, jlong size, jboolean initzero) {
-  PMALPool *pool;
-  void* nativebuf = NULL;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  void* p = addr_from_java(addr);
-  nativebuf = pmalrealloc(pool, p, size, initzero);
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-  return addr_to_java(nativebuf);
-}
-
-JNIEXPORT
-void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nfree(
-    JNIEnv* env,
-    jobject this, jlong id,
-    jlong addr) {
-  PMALPool *pool;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  void* nativebuf = addr_from_java(addr);
-  pmalfree(pool, nativebuf);
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-}
-
-JNIEXPORT
-void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nsync(
-    JNIEnv* env,
-    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect) {
-  PMALPool *pool;
-  void *nativebuf;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  void *p = addr_from_java(addr);
-  if (autodetect) {
-    if (NULL != p) {
-      nativebuf = p - PMBHSZ;
-      pmsync(pool->pmp, nativebuf, ((PMBHeader *) nativebuf)->size);
-    } else {
-      pmsync(pool->pmp, b_addr(pool->pmp), pool->capacity);
-    }
-  } else {
-    if (NULL != p && len > 0L) {
-      pmsync(pool->pmp, p, len);
-    }
-  }
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-}
-
-JNIEXPORT
-void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_npersist(
-    JNIEnv* env,
-    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect) {
-  PMALPool *pool;
-  void *nativebuf;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  void *p = addr_from_java(addr);
-  if (autodetect) {
-    if (NULL != p) {
-      nativebuf = p - PMBHSZ;
-      pmsync(pool->pmp, nativebuf, ((PMBHeader *) nativebuf)->size);
-    } else {
-      pmsync(pool->pmp, b_addr(pool->pmp), pool->capacity);
-    }
-  } else {
-    if (NULL != p && len > 0L) {
-      pmsync(pool->pmp, p, len);
-    }
-  }
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-}
-
-JNIEXPORT
-void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nflush(
-    JNIEnv* env,
-    jobject this, jlong id, jlong addr, jlong len, jboolean autodetect) {
-  PMALPool *pool;
-  void *nativebuf;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  void *p = addr_from_java(addr);
-  if (autodetect) {
-    if (NULL != p) {
-      nativebuf = p - PMBHSZ;
-      pmsync(pool->pmp, nativebuf, ((PMBHeader *) nativebuf)->size);
-    } else {
-      pmsync(pool->pmp, b_addr(pool->pmp), pool->capacity);
-    }
-  } else {
-    if (NULL != p && len > 0L) {
-      pmsync(pool->pmp, p, len);
-    }
-  }
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-}
-
-JNIEXPORT
-void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_ndrain(
-    JNIEnv* env,
-    jobject this, jlong id)
-{
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_ncapacity(
-    JNIEnv* env,
-    jobject this, jlong id) {
-  PMALPool *pool;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  jlong ret = pool->capacity;
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-  return ret;
-}
-
-JNIEXPORT
-jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_ncreateByteBuffer(
-    JNIEnv *env, jobject this, jlong id, jlong size) {
-  PMALPool *pool;
-  jobject ret = NULL;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  void* nativebuf = pmalrealloc(pool, NULL, size, 0);
-  if (NULL != nativebuf) {
-    ret = (*env)->NewDirectByteBuffer(env, nativebuf, size);
-  }
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-  return ret;
-}
-
-JNIEXPORT
-jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nretrieveByteBuffer(
-    JNIEnv *env, jobject this, jlong id, jlong addr) {
-  jobject ret = NULL;
-  void* p = addr_from_java(addr);
-  if (NULL != p) {
-    void* nativebuf = p - PMBHSZ;
-    ret = (*env)->NewDirectByteBuffer(env, p, ((PMBHeader *) nativebuf)->size 
- PMBHSZ);
-  }
-  return ret;
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nretrieveSize(JNIEnv
 *env,
-    jobject this, jlong id, jlong addr) {
-  PMALPool *pool;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  void* p = addr_from_java(addr);
-  jlong ret = pmalsize(pool, p);
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-  return ret;
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_ngetByteBufferHandler(
-    JNIEnv *env, jobject this, jlong id, jobject bytebuf) {
-//     fprintf(stderr, "ngetByteBufferAddress Get Called %X, %X\n", env, 
bytebuf);
-  jlong ret = 0L;
-  if (NULL != bytebuf) {
-    void* nativebuf = (*env)->GetDirectBufferAddress(env, bytebuf);
-//     fprintf(stderr, "ngetByteBufferAddress Get Native addr %X\n", 
nativebuf);
-    ret = addr_to_java(nativebuf);
-  }
-//    fprintf(stderr, "ngetByteBufferAddress returned addr %016lx\n", ret);
-  return ret;
-}
-
-JNIEXPORT
-jobject JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nresizeByteBuffer(
-    JNIEnv *env, jobject this, jlong id, jobject bytebuf, jlong size) {
-  PMALPool *pool;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  jobject ret = NULL;
-  if (NULL != bytebuf) {
-    void* nativebuf = (*env)->GetDirectBufferAddress(env, bytebuf);
-    if (nativebuf != NULL) {
-      nativebuf = pmalrealloc(pool, nativebuf, size, 0);
-      if (NULL != nativebuf) {
-        ret = (*env)->NewDirectByteBuffer(env, nativebuf, size);
-      }
-    }
-  }
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-  return ret;
-}
-
-JNIEXPORT
-void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_ndestroyByteBuffer(
-    JNIEnv *env, jobject this, jlong id, jobject bytebuf) {
-  PMALPool *pool;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  if (NULL != bytebuf) {
-    void* nativebuf = (*env)->GetDirectBufferAddress(env, bytebuf);
-    pmalfree(pool, nativebuf);
-  }
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-}
-
-JNIEXPORT
-void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nsetHandler(
-    JNIEnv *env, jobject this, jlong id, jlong key, jlong value) {
-  PMALPool *pool;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  if (key < PMALLOC_KEYS && key >= 0) {
-    pmalloc_setkey(pool->pmp, key, (void*)value);
-  }
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_ngetHandler(JNIEnv
 *env,
-    jobject this, jlong id, jlong key) {
-  PMALPool *pool;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  jlong ret = (key < PMALLOC_KEYS && key >= 0) ? (long) 
pmalloc_getkey(pool->pmp, key) : 0;
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-  return ret;
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nhandlerCapacity(
-    JNIEnv *env, jobject this) {
-  return PMALLOC_KEYS;
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_ngetBaseAddress(JNIEnv
 *env,
-    jobject this, jlong id) {
-  PMALPool *pool;
-  pthread_rwlock_rdlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  jlong ret = (long) b_addr(pool->pmp);
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-  return ret;
-}
-
-JNIEXPORT
-jlong JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_ninit(JNIEnv
 *env,
-    jclass this, jlong capacity, jstring pathname, jboolean isnew) {
-  PMALPool *pool;
-  size_t ret = -1;
-  void *md = NULL;
-  pthread_rwlock_wrlock(&g_pmalp_rwlock);
-  const char* mpathname = (*env)->GetStringUTFChars(env, pathname, NULL);
-  if (NULL == mpathname) {
-    pthread_rwlock_unlock(&g_pmalp_rwlock);
-    throw(env, "Big memory path not specified!");
-  }
-  int needcreate = access(mpathname, F_OK);
-  if (isnew && !needcreate) {
-    if(0 != unlink(mpathname)) {
-      throw(env, "Failure to delete file to create new one.");
-    }
-  }
-  if ((md = pmopen(mpathname, NULL,
-                   PMALLOC_MIN_POOL_SIZE > capacity ? PMALLOC_MIN_POOL_SIZE : 
capacity)) == NULL) {
-    pthread_rwlock_unlock(&g_pmalp_rwlock);
-    throw(env, "Big memory init failure!");
-  }
-  (*env)->ReleaseStringUTFChars(env, pathname, mpathname);
-  g_pmalpool_arr = realloc(g_pmalpool_arr, (g_pmalpool_count + 1) * 
sizeof(PMALPool));
-  if (NULL != g_pmalpool_arr) {
-    pool = g_pmalpool_arr + g_pmalpool_count;
-    pool->pmp = md;
-    pool->capacity = pmcapacity(pool->pmp);
-    pthread_mutex_init(&pool->mutex, NULL);
-    ret = g_pmalpool_count;
-    ++g_pmalpool_count;
-  } else {
-    pthread_rwlock_unlock(&g_pmalp_rwlock);
-    throw(env, "Big memory init Out of memory!");
-  }
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-  return ret;
-}
-
-JNIEXPORT
-void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_nclose
-(JNIEnv *env, jobject this, jlong id)
-{
-  PMALPool *pool;
-  pthread_rwlock_wrlock(&g_pmalp_rwlock);
-  pool = g_pmalpool_arr + id;
-  pthread_mutex_lock(&pool->mutex);
-  if (NULL != pool->pmp) {
-    pmclose(pool->pmp);
-    pool->pmp = NULL;
-    pool->capacity = 0;
-  }
-  pthread_mutex_unlock(&pool->mutex);
-  pthread_mutex_destroy(&pool->mutex);
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-}
-
-__attribute__((destructor)) void fini(void) {
-  int i;
-  PMALPool *pool;
-  pthread_rwlock_wrlock(&g_pmalp_rwlock);
-  if (NULL != g_pmalpool_arr) {
-    for (i = 0; i < g_pmalpool_count; ++i) {
-      pool = g_pmalpool_arr + i;
-      if (NULL != pool->pmp) {
-        pmclose(pool->pmp);
-        pool->pmp = NULL;
-        pool->capacity = 0;
-        pthread_mutex_destroy(&pool->mutex);
-      }
-    }
-    free(g_pmalpool_arr);
-    g_pmalpool_arr = NULL;
-    g_pmalpool_count = 0;
-  }
-  pthread_rwlock_unlock(&g_pmalp_rwlock);
-  pthread_rwlock_destroy(&g_pmalp_rwlock);
-}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.h
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.h
 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.h
deleted file mode 100644
index 819ab67..0000000
--- 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/native/org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <jni.h>
-/* Header for class PMallocServiceImpl */
-
-#include "common.h"
-
-#ifndef 
_Included_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl
-#define 
_Included_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class:     
org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl
- * Method:    jniInit
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_jniInit
-(JNIEnv *, jobject, jint, jint);
-
-/*
- * Class:     
org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl
- * Method:    jniTerm
- * Signature: ()V
- */
-JNIEXPORT void JNICALL 
Java_org_apache_mnemonic_service_memoryservice_internal_PMallocServiceImpl_jniTerm
-(JNIEnv *, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService
 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService
new file mode 100644
index 0000000..5cfe669
--- /dev/null
+++ 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memory.NonVolatileMemoryAllocatorService
@@ -0,0 +1 @@
+org.apache.mnemonic.service.memory.internal.PMallocServiceImpl

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/a4bb10eb/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memoryservice.NonVolatileMemoryAllocatorService
----------------------------------------------------------------------
diff --git 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memoryservice.NonVolatileMemoryAllocatorService
 
b/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memoryservice.NonVolatileMemoryAllocatorService
deleted file mode 100644
index 47b49a6..0000000
--- 
a/mnemonic-memory-services/mnemonic-pmalloc-service/src/main/resources/META-INF/services/org.apache.mnemonic.service.memoryservice.NonVolatileMemoryAllocatorService
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.mnemonic.service.memoryservice.internal.PMallocServiceImpl

Reply via email to