gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-akono] branch master updated: less logging, various tweaks


From: gnunet
Subject: [taler-akono] branch master updated: less logging, various tweaks
Date: Thu, 14 Nov 2019 17:24:29 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository akono.

The following commit(s) were added to refs/heads/master by this push:
     new 731ac695 less logging, various tweaks
731ac695 is described below

commit 731ac6951e21ae013345b7b595c54d8e7ac6ad33
Author: Florian Dold <address@hidden>
AuthorDate: Thu Nov 14 17:24:22 2019 +0100

    less logging, various tweaks
---
 akono/akono-akono.iml                 | 249 ++++++++--------------------------
 akono/build.gradle.kts                |   4 +-
 akono/src/main/cpp/akono-jni.cpp      | 190 ++++++++++++--------------
 akono/src/main/java/akono/AkonoJni.kt |  66 ++++-----
 4 files changed, 178 insertions(+), 331 deletions(-)

diff --git a/akono/akono-akono.iml b/akono/akono-akono.iml
index 6f731674..4ea461bc 100644
--- a/akono/akono-akono.iml
+++ b/akono/akono-akono.iml
@@ -1,9 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.id=":akono" 
external.linked.project.path="$MODULE_DIR$/../../../akono" 
external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" 
type="JAVA_MODULE" version="4">
+<module external.linked.project.id=":akono" 
external.linked.project.path="$MODULE_DIR$" 
external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" 
type="JAVA_MODULE" version="4">
   <component name="FacetManager">
     <facet type="android-gradle" name="Android-Gradle">
       <configuration>
         <option name="GRADLE_PROJECT_PATH" value=":akono" />
+        <option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="3.3.2" />
+        <option name="LAST_KNOWN_AGP_VERSION" value="3.3.2" />
       </configuration>
     </facet>
     <facet type="native-android-gradle" name="Native-Android-Gradle">
@@ -22,17 +24,17 @@
         <option name="ALLOW_USER_CONFIGURATION" value="false" />
         <option name="MANIFEST_FILE_RELATIVE_PATH" 
value="/src/main/AndroidManifest.xml" />
         <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
-        <option name="RES_FOLDERS_RELATIVE_PATH" 
value="file://$MODULE_DIR$/../../../akono/build/generated/res/rs/debug;file://$MODULE_DIR$/../../../akono/build/generated/res/resValues/debug"
 />
-        <option name="TEST_RES_FOLDERS_RELATIVE_PATH" 
value="file://$MODULE_DIR$/../../../akono/build/generated/res/rs/androidTest/debug;file://$MODULE_DIR$/../../../akono/build/generated/res/resValues/androidTest/debug"
 />
+        <option name="RES_FOLDERS_RELATIVE_PATH" 
value="file://$MODULE_DIR$/build/generated/res/rs/debug;file://$MODULE_DIR$/build/generated/res/resValues/debug"
 />
+        <option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
         <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
         <option name="PROJECT_TYPE" value="1" />
       </configuration>
     </facet>
     <facet type="kotlin-language" name="Kotlin">
-      <configuration version="3" platform="JVM 1.6" useProjectSettings="false">
+      <configuration version="3" platform="JVM 1.6" allPlatforms="JVM [1.6]" 
useProjectSettings="false" 
pureKotlinSourceFolders="$MODULE_DIR$/src/debug/kotlin;/home/dold/repos/akono/akono/src/debug/java;/home/dold/repos/akono/akono/src/release/kotlin;/home/dold/repos/akono/akono/src/release/java;/home/dold/repos/akono/akono/src/debugAndroidTest/kotlin;/home/dold/repos/akono/akono/src/debugUnitTest/kotlin;/home/dold/repos/akono/akono/src/releaseUnitTest/kotlin">
         <compilerSettings />
         <compilerArguments>
-          <option name="destination" 
value="$MODULE_DIR$/../../../akono/build/tmp/kotlin-classes/debug" />
+          <option name="destination" 
value="$MODULE_DIR$/build/tmp/kotlin-classes/debug" />
           <option name="classpath" 
value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.3.21/d207ce2c9bcf17dc8e51bab4dbfdac4d013e7138/kotlin-stdlib-jdk7-1.3.21.jar:/home/dold/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.21/4bcc2012b84840e19e1e28074284cac908be0295/kotlin-stdlib-1.3.21.jar:/home/dold/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.21/f30e4a9897913e53d778f564110bafa1fef4
 [...]
           <option name="noStdlib" value="true" />
           <option name="noReflect" value="true" />
@@ -59,23 +61,23 @@
     </facet>
   </component>
   <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
-    <output 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes"
 />
-    <output-test 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/javac/debugUnitTest/compileDebugUnitTestJavaWithJavac/classes"
 />
+    <output 
url="file://$MODULE_DIR$/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes"
 />
+    <output-test 
url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/compileDebugUnitTestJavaWithJavac/classes"
 />
     <exclude-output />
-    <content url="file://$MODULE_DIR$/../../../akono">
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/main/cpp" 
isTestSource="false" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/source/apt/debug" 
isTestSource="false" generated="true" />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/cpp" 
isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/apt/debug" 
isTestSource="false" generated="true" />
       <sourceFolder 
url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out"
 isTestSource="false" generated="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/source/buildConfig/debug"
 isTestSource="false" generated="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out"
 isTestSource="false" generated="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/res/rs/debug" 
type="java-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/res/resValues/debug" 
type="java-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/source/apt/androidTest/debug"
 isTestSource="true" generated="true" />
+      <sourceFolder 
url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" 
isTestSource="false" generated="true" />
+      <sourceFolder 
url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out"
 isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" 
type="java-resource" generated="true" />
+      <sourceFolder 
url="file://$MODULE_DIR$/build/generated/res/resValues/debug" 
type="java-resource" generated="true" />
+      <sourceFolder 
url="file://$MODULE_DIR$/build/generated/source/apt/androidTest/debug" 
isTestSource="true" generated="true" />
       <sourceFolder 
url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out"
 isTestSource="true" generated="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/source/buildConfig/androidTest/debug"
 isTestSource="true" generated="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/renderscript_source_output_dir/debugAndroidTest/compileDebugAndroidTestRenderscript/out"
 isTestSource="true" generated="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/res/rs/androidTest/debug"
 type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/res/resValues/androidTest/debug"
 type="java-test-resource" />
+      <sourceFolder 
url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" 
isTestSource="true" generated="true" />
+      <sourceFolder 
url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/compileDebugAndroidTestRenderscript/out"
 isTestSource="true" generated="true" />
+      <sourceFolder 
url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" 
type="java-test-resource" generated="true" />
+      <sourceFolder 
url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" 
type="java-test-resource" generated="true" />
       <sourceFolder 
url="file://$MODULE_DIR$/build/generated/source/apt/test/debug" 
isTestSource="true" generated="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/debug/res" 
type="java-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" 
type="java-resource" />
@@ -85,14 +87,6 @@
       <sourceFolder url="file://$MODULE_DIR$/src/debug/jni" 
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" 
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" 
type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" 
type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" 
type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" 
isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" 
type="java-test-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" 
type="java-test-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" 
type="java-test-resource" />
@@ -101,11 +95,19 @@
       <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/jni" 
isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" 
isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" 
isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" 
type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" 
type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" 
type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" 
isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" 
isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" 
isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" 
isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" 
isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/main/res" 
type="java-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/main/resources" 
type="java-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/main/assets" 
type="java-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/main/java" 
isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" 
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src/main/jni" 
isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" 
/>
       <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" 
isTestSource="false" />
@@ -113,7 +115,7 @@
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" 
type="java-test-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" 
type="java-test-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTest/java" 
isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" 
isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" 
isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" 
isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" 
isTestSource="true" />
@@ -121,181 +123,46 @@
       <sourceFolder url="file://$MODULE_DIR$/src/test/resources" 
type="java-test-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/test/assets" 
type="java-test-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src/test/aidl" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/test/java" 
isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" 
isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" 
/>
       <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" 
/>
       <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out"
 isTestSource="false" generated="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out"
 isTestSource="true" generated="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/build/generated/source/apt/test/debug" 
isTestSource="true" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/debug/res" 
type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/debug/resources" 
type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/debug/assets" 
type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/debug/aidl" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/debug/java" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/debug/jni" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/debug/rs" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/debug/shaders" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/testDebug/res" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/src/testDebug/resources" 
type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/testDebug/assets" 
type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/testDebug/aidl" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/testDebug/java" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/testDebug/jni" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/testDebug/rs" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/src/testDebug/shaders" isTestSource="true" 
/>
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/src/androidTestDebug/res" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/src/androidTestDebug/resources" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/src/androidTestDebug/assets" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/src/androidTestDebug/aidl" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/src/androidTestDebug/java" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/src/androidTestDebug/jni" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/src/androidTestDebug/rs" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/src/androidTestDebug/shaders" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/main/res" 
type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/main/resources" 
type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/main/assets" 
type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/main/aidl" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/main/jni" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/main/rs" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/main/shaders" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/androidTest/res" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/src/androidTest/resources" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/src/androidTest/assets" 
type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/androidTest/aidl" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/androidTest/jni" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/androidTest/rs" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../akono/src/androidTest/shaders" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/test/res" 
type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/test/resources" 
type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/test/assets" 
type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/test/aidl" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/test/jni" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/test/rs" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../akono/src/test/shaders" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out"
 isTestSource="false" generated="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out"
 isTestSource="true" generated="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/source/apt/test/debug" 
isTestSource="true" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/debug/res" 
type="java-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/debug/resources" 
type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/debug/assets" 
type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/debug/aidl" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/debug/java" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/debug/jni" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/debug/rs" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/debug/shaders" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/testDebug/res" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/testDebug/resources" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/testDebug/assets" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/testDebug/aidl" isTestSource="true" 
/>
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/testDebug/java" isTestSource="true" 
/>
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/testDebug/jni" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/testDebug/rs" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/testDebug/shaders" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTestDebug/res" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTestDebug/resources" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTestDebug/assets" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTestDebug/aidl" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTestDebug/java" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTestDebug/jni" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTestDebug/rs" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTestDebug/shaders" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/main/res" 
type="java-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/main/resources" 
type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/main/assets" 
type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/main/aidl" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/main/jni" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/main/rs" 
isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/main/shaders" 
isTestSource="false" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTest/res" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTest/resources" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTest/assets" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTest/aidl" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTest/jni" 
isTestSource="true" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTest/rs" isTestSource="true" 
/>
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/androidTest/shaders" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/test/res" 
type="java-test-resource" />
-      <sourceFolder 
url="file://$MODULE_DIR$/../../../akono/src/test/resources" 
type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/test/assets" 
type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/test/aidl" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/test/jni" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/test/rs" 
isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/../../../akono/src/test/shaders" 
isTestSource="true" />
-      <excludeFolder url="file://$MODULE_DIR$/build/generated/source/r" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../akono/build/generated/source/r" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/.externalNativeBuild" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/not_namespaced_r_class_sources"
 />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/generated/source/r" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/aapt_friendly_merged_manifests"
 />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/annotation_processor_list"
 />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/annotations_typedef_file"
 />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/annotations_zip" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/apk_list" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/blame" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/check_manifest_result"
 />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/cmake" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/compile_only_not_namespaced_r_class_jar"
 />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/dex" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/incremental" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/intermediate-jars" 
/>
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/javac" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/jniLibs" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/library_and_local_jars_jni"
 />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/library_assets" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/library_manifest" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/merged_assets" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/merged_manifests" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/packaged-classes" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/packaged_res" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/processed_res" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/public_res" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/res" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/rs" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/shader_assets" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/shaders" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/signing_config" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/symbols" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/tmp" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/transforms" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/intermediates/validate_signing_config"
 />
-      <excludeFolder url="file://$MODULE_DIR$/../../../akono/build/kotlin" />
-      <excludeFolder url="file://$MODULE_DIR$/../../../akono/build/outputs" />
-      <excludeFolder url="file://$MODULE_DIR$/../../../akono/build/reports" />
-      <excludeFolder 
url="file://$MODULE_DIR$/../../../akono/build/test-results" />
-      <excludeFolder url="file://$MODULE_DIR$/../../../akono/build/tmp" />
+      <excludeFolder url="file://$MODULE_DIR$/.cxx" />
+      <excludeFolder url="file://$MODULE_DIR$/.externalNativeBuild" />
+      <excludeFolder url="file://$MODULE_DIR$/build" />
     </content>
     <orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android 
SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.test.ext:junit:1.1.0@aar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.guava:failureaccess:1.0.1@jar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.errorprone:error_prone_annotations:2.3.1@jar" level="project" />
-    <orderEntry type="library" name="Gradle: 
org.jetbrains.kotlin:kotlin-stdlib-common:1.3.21@jar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.test:monitor:1.1.1@aar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
org.jetbrains.kotlin:kotlin-test-junit:1.3.21@jar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.test:rules:1.1.1@aar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.test.ext:truth:1.1.0@aar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
org.checkerframework:checker-compat-qual:2.5.5@jar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.test:runner:1.1.1@aar" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.truth:truth:0.44@jar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
org.jetbrains.kotlin:kotlin-test-junit:1.3.21@jar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
org.jetbrains.kotlin:kotlin-test:1.3.21@jar" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.lifecycle:lifecycle-common:2.0.0@jar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.auto.value:auto-value-annotations:1.6.3@jar" level="project" />
-    <orderEntry type="library" name="Gradle: 
org.jetbrains:annotations:13.0@jar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
org.jetbrains.kotlin:kotlin-test-common:1.3.21@jar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.j2objc:j2objc-annotations:1.1@jar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.annotation:annotation:1.0.0@jar" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: 
junit:junit:4.12@jar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
com.googlecode.java-diff-utils:diffutils:1.3.0@jar" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: 
org.hamcrest:hamcrest-core:1.3@jar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.test:core:1.1.0@aar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.annotation:annotation:1.0.0@jar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
org.jetbrains.kotlin:kotlin-test:1.3.21@jar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
org.jetbrains.kotlin:kotlin-test-annotations-common:1.3.21@jar" level="project" 
/>
+    <orderEntry type="library" scope="TEST" name="Gradle: 
net.sf.kxml:kxml2:2.3.0@jar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.guava:guava:27.0.1-android@jar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.guava:failureaccess:1.0.1@jar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava@jar"
 level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.code.findbugs:jsr305:3.0.2@jar" level="project" />
-    <orderEntry type="library" name="Gradle: 
org.jetbrains.kotlin:kotlin-stdlib:1.3.21@jar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
org.checkerframework:checker-compat-qual:2.5.5@jar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.errorprone:error_prone_annotations:2.3.1@jar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.j2objc:j2objc-annotations:1.1@jar" level="project" />
     <orderEntry type="library" scope="TEST" name="Gradle: 
org.codehaus.mojo:animal-sniffer-annotations:1.17@jar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
com.googlecode.java-diff-utils:diffutils:1.3.0@jar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.auto.value:auto-value-annotations:1.6.3@jar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
org.jetbrains.kotlin:kotlin-test-common:1.3.21@jar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
org.jetbrains.kotlin:kotlin-test-annotations-common:1.3.21@jar" level="project" 
/>
+    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.test.ext:junit:1.1.0@aar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.test.ext:truth:1.1.0@aar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.test:core:1.1.0@aar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.test:rules:1.1.1@aar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.test:runner:1.1.1@aar" level="project" />
+    <orderEntry type="library" scope="TEST" name="Gradle: 
androidx.test:monitor:1.1.1@aar" level="project" />
     <orderEntry type="library" name="Gradle: 
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.21@jar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava@jar"
 level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
com.google.guava:guava:27.0.1-android@jar" level="project" />
-    <orderEntry type="library" scope="TEST" name="Gradle: 
net.sf.kxml:kxml2:2.3.0@jar" level="project" />
+    <orderEntry type="library" name="Gradle: 
org.jetbrains.kotlin:kotlin-stdlib:1.3.21@jar" level="project" />
+    <orderEntry type="library" name="Gradle: 
org.jetbrains.kotlin:kotlin-stdlib-common:1.3.21@jar" level="project" />
+    <orderEntry type="library" name="Gradle: 
org.jetbrains:annotations:13.0@jar" level="project" />
     <orderEntry type="library" name="Gradle: android.test.mock-android-28" 
level="project" />
     <orderEntry type="library" name="Gradle: android.test.base-android-28" 
level="project" />
     <orderEntry type="library" name="Gradle: android.test.runner-android-28" 
level="project" />
diff --git a/akono/build.gradle.kts b/akono/build.gradle.kts
index b98510db..1fdda41d 100644
--- a/akono/build.gradle.kts
+++ b/akono/build.gradle.kts
@@ -8,11 +8,11 @@ plugins {
 android {
     compileSdkVersion(28)
     defaultConfig {
-        minSdkVersion(26)
+        minSdkVersion(17)
         targetSdkVersion(28)
 
         versionCode = 1
-        versionName = "1.0"
+        versionName = "0.0.1"
 
         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
         // Specifies the application ID for the test APK.
diff --git a/akono/src/main/cpp/akono-jni.cpp b/akono/src/main/cpp/akono-jni.cpp
index 0480eea5..069f3774 100644
--- a/akono/src/main/cpp/akono-jni.cpp
+++ b/akono/src/main/cpp/akono-jni.cpp
@@ -3,6 +3,10 @@
 #include <libplatform/libplatform.h>
 #include <v8.h>
 
+#include <sys/types.h>
+#include <sys/syscall.h>
+
+
 #define NODE_WANT_INTERNALS 1
 
 #include <node.h>
@@ -14,6 +18,9 @@
 #include <node_native_module_env.h>
 
 
+pthread_mutex_t node_loop_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+
 
 // Provide stubs so that libnode.so links properly
 namespace node {
@@ -35,12 +42,12 @@ namespace node {
 
 static int pfd[2];
 static pthread_t thr;
-static const char *tag = "myapp";
+static const char *tag = "akono";
 
 
 static void *thread_func(void *) {
     ssize_t rdsz;
-    char buf[128];
+    char buf[1024];
     while ((rdsz = read(pfd[0], buf, sizeof buf - 1)) > 0) {
         if (buf[rdsz - 1] == '\n') --rdsz;
         buf[rdsz] = 0;  /* add null-terminator */
@@ -53,8 +60,7 @@ static void mylog(const char *msg) {
     __android_log_write(ANDROID_LOG_DEBUG, tag, msg);
 }
 
-int start_logger(const char *app_name) {
-    tag = app_name;
+int start_logger() {
 
     /* make stdout line-buffered and stderr unbuffered */
     setvbuf(stdout, 0, _IOLBF, 0);
@@ -115,28 +121,24 @@ static void loadModuleCallback(const 
v8::FunctionCallbackInfo<v8::Value> &args);
 static void getDataCallback(const v8::FunctionCallbackInfo<v8::Value> &args);
 
 static const char *main_code = "global.__akono_run = (x) => {"
-                               "  console.log('running code', x);"
-                               "  global.eval(x);"
+                               "  setImmediate(() => global.eval(x));"
+                               "  return; "
                                "};"
                                ""
                                "global.__akono_onMessage = (x) => {"
-                               "  console.log('got __akono_onMessage', x);"
+                               "  console.log('got unhandled 
__akono_onMessage', x);"
                                "};"
                                ""
                                "mod = require('module');"
                                "mod._saved_findPath = mod._findPath;"
                                "mod._akonoMods = {};"
                                "mod._findPath = (request, paths, isMain) => {"
-                               "  console.log('in _findPath');"
                                "  const res = mod._saved_findPath(request, 
paths, isMain);"
                                "  if (res !== false) return res;"
                                "  const args = JSON.stringify({ request, 
paths});"
                                "  const loadResult = 
JSON.parse(global.__akono_loadModule(args));"
-                               "  console.log('got loadModule result');"
                                "  if (!loadResult) return false;"
-                               "  console.log('loadModule path is', 
loadResult.path);"
                                "  mod._akonoMods[loadResult.path] = 
loadResult;"
-                               "  console.log('returning path', 
loadResult.path);"
                                "  return loadResult.path;"
                                "};"
                                ""
@@ -149,24 +151,19 @@ static const char *main_code = "global.__akono_run = (x) 
=> {"
                                ""
                                "mod._saved_js_extension = 
mod._extensions[\".js\"];"
                                "mod._extensions[\".js\"] = (module, filename) 
=> {"
-                               "  console.log('handling js extension', 
[module, filename]);"
                                "  if (mod._akonoMods.hasOwnProperty(filename)) 
{"
                                "    const akmod = mod._akonoMods[filename];"
-                               "    console.log('found mod');"
                                "    const content = akmod.content;"
                                "    module._compile(stripBOM(content), 
filename);"
                                "    return;"
                                "  }"
-                               "  console.log('falling back');"
                                "  return mod._saved_js_extension(module, 
filename);"
                                "};"
                                ""
                                "mod._saved_json_extension = 
mod._extensions[\".json\"];"
                                "mod._extensions[\".json\"] = (module, 
filename) => {"
-                               "  console.log('handling json extension', 
[module, filename]);"
                                "  if (mod._akonoMods.hasOwnProperty(filename)) 
{"
                                "    const akmod = mod._akonoMods[filename];"
-                               "    console.log('found mod');"
                                "    const content = akmod.content;"
                                "    try {"
                                "      module.exports = 
JSON.parse(stripBOM(content));"
@@ -176,7 +173,6 @@ static const char *main_code = "global.__akono_run = (x) => 
{"
                                "      throw err;"
                                "    }"
                                "  }"
-                               "  console.log('falling back');"
                                "  return mod._saved_json_extension(module, 
filename);"
                                "};"
                                "";
@@ -186,8 +182,8 @@ class NativeAkonoInstance {
 private:
     static bool logInitialized;
     static bool v8Initialized;
-    //static std::unique_ptr<v8::Platform> platform;
     static node::MultiIsolatePlatform *platform;
+    static NativeAkonoInstance *singleton_instance;
 public:
     v8::Isolate *isolate;
     node::Environment *environment;
@@ -195,16 +191,17 @@ public:
     uv_async_t async_notify;
     uv_loop_t *loop;
     bool breakRequested = false;
-    JNIEnv *currentJniEnv = nullptr;
     jobject currentJniThiz = nullptr;
+    JavaVM *javaVm = nullptr;
+
+    static NativeAkonoInstance *getInstance();
 
     NativeAkonoInstance() : globalContext() {
         loop = uv_default_loop();
         uv_async_init(loop, &async_notify, notifyCb);
-        async_notify.data = this;
 
         if (!logInitialized) {
-            start_logger("myapp");
+            start_logger();
             logInitialized = true;
         }
 
@@ -305,17 +302,18 @@ public:
      * @param env JNI env of the thread we're running in.
      */
     void runNode() {
-        v8::Isolate::Scope isolate_scope(isolate);
-        v8::HandleScope handle_scope(isolate);
-        v8::Local<v8::Context> context = globalContext.Get(isolate);
-        v8::Context::Scope context_scope(context);
-        this->breakRequested = false;
-        while (1) {
-            uv_run(uv_default_loop(), UV_RUN_ONCE);
-            platform->DrainTasks(isolate);
-            if (this->breakRequested)
-                break;
-        }
+            v8::Locker v8Locker(isolate);
+            v8::Isolate::Scope isolate_scope(isolate);
+            v8::HandleScope handle_scope(isolate);
+            v8::Local<v8::Context> context = globalContext.Get(isolate);
+            v8::Context::Scope context_scope(context);
+            this->breakRequested = false;
+            while (1) {
+                uv_run(uv_default_loop(), UV_RUN_ONCE);
+                platform->DrainTasks(isolate);
+                if (this->breakRequested)
+                    break;
+            }
     }
 
     /**
@@ -324,7 +322,7 @@ public:
      * Must not be called from a different thread.
      */
     void makeCallback(const char *code) {
-        mylog("in makeCallback");
+        v8::Locker v8Locker(isolate);
         v8::Isolate::Scope isolate_scope(isolate);
         v8::HandleScope handle_scope(isolate);
         v8::Local<v8::Context> context = globalContext.Get(isolate);
@@ -334,7 +332,6 @@ public:
                 v8::String::NewFromUtf8(isolate, code,
                                         
v8::NewStringType::kNormal).ToLocalChecked()
         };
-        mylog("calling node::MakeCallback");
         node::MakeCallback(isolate, global, "__akono_run", 1, argv, {0, 0});
     }
 
@@ -343,8 +340,6 @@ public:
     }
 
     jstring evalJs(JNIEnv *env, jstring sourceString) {
-        mylog("begin evalJs");
-
         JStringValue jsv(env, sourceString);
 
         v8::Isolate::Scope isolate_scope(isolate);
@@ -370,14 +365,10 @@ public:
             // Compile the source code.
             v8::Local<v8::Script> script;
 
-            mylog("about to compile script");
-
             if (!v8::Script::Compile(context, source).ToLocal(&script)) {
                 return nullptr;
             }
 
-            mylog("about to run script");
-
             // Run the script to get the result.
             v8::Local<v8::Value> result;
             if (!script->Run(context).ToLocal(&result)) {
@@ -385,13 +376,9 @@ public:
                 return nullptr;
             }
 
-            mylog("converting script result value");
-
             // Convert the result to an UTF8 string and print it.
             v8::String::Utf8Value utf8(isolate, result);
 
-            mylog("about to return value");
-
             return env->NewStringUTF(*utf8);
         }
     }
@@ -401,35 +388,45 @@ public:
 bool NativeAkonoInstance::v8Initialized = false;
 bool NativeAkonoInstance::logInitialized = false;
 node::MultiIsolatePlatform *NativeAkonoInstance::platform = nullptr;
+NativeAkonoInstance *NativeAkonoInstance::singleton_instance = nullptr;
+
+NativeAkonoInstance *NativeAkonoInstance::getInstance() {
+    if (nullptr == NativeAkonoInstance::singleton_instance) {
+        NativeAkonoInstance::singleton_instance = new NativeAkonoInstance();
+    }
+    return NativeAkonoInstance::singleton_instance;
+
+}
 
 
 void notifyCb(uv_async_t *async) {
-    NativeAkonoInstance *akono = (NativeAkonoInstance *) async->data;
-    mylog("async notifyCb called!");
+    NativeAkonoInstance *akono = NativeAkonoInstance::getInstance();
+    v8::Locker v8Locker(akono->isolate);
     akono->breakRequested = true;
 }
 
+
 static void sendMessageCallback(const v8::FunctionCallbackInfo<v8::Value> 
&args) {
+    NativeAkonoInstance *myInstance = NativeAkonoInstance::getInstance();
+    v8::Locker v8Locker(myInstance->isolate);
     if (args.Length() < 1) return;
     v8::Isolate *isolate = args.GetIsolate();
     v8::HandleScope scope(isolate);
     v8::Local<v8::Value> arg = args[0];
     v8::String::Utf8Value value(isolate, arg);
-    mylog("sendMessageCallback called, yay!");
 
-    v8::Local<v8::Object> data = v8::Local<v8::Object>::Cast(args.Data());
-
-    mylog("getting instance");
-    NativeAkonoInstance *myInstance = (NativeAkonoInstance *) 
data->GetAlignedPointerFromInternalField(0);
+    JNIEnv *env;
 
-    JNIEnv *env = myInstance->currentJniEnv;
+    if (JNI_OK != myInstance->javaVm->GetEnv((void **) &env, JNI_VERSION_1_6)) 
{
+        mylog("FATAL ERROR: could not get JVM env handle");
+        return;
+    }
 
     if (env == nullptr) {
         mylog("FATAL: JNI env is nullptr");
         return;
     }
 
-    mylog("finding class");
     jclass clazz = env->FindClass("akono/AkonoJni");
 
     if (clazz == nullptr) {
@@ -437,46 +434,35 @@ static void sendMessageCallback(const 
v8::FunctionCallbackInfo<v8::Value> &args)
         return;
     }
 
-    mylog("creating strings");
-    jstring jstr1 = env->NewStringUTF("message");
-    jstring jstr2 = env->NewStringUTF(*value);
-
-    mylog("getting method");
+    jstring jstr = env->NewStringUTF(*value);
 
-    jmethodID meth = env->GetMethodID(clazz, "internalOnNotify", 
"(Ljava/lang/String;Ljava/lang/String;)V");
+    jmethodID meth = env->GetMethodID(clazz, "internalOnNotify", 
"(Ljava/lang/String;)V");
 
     if (meth == nullptr) {
         mylog("FATAL: method not found");
         return;
     }
 
-    mylog("calling method");
-
-    env->CallVoidMethod(myInstance->currentJniThiz, meth, jstr1, jstr2);
+    env->CallVoidMethod(myInstance->currentJniThiz, meth, jstr);
 }
 
 
 static void loadModuleCallback(const v8::FunctionCallbackInfo<v8::Value> 
&args) {
+    NativeAkonoInstance *myInstance = NativeAkonoInstance::getInstance();
+    v8::Locker v8Locker(myInstance->isolate);
     if (args.Length() < 1) return;
     v8::Isolate *isolate = args.GetIsolate();
     v8::HandleScope scope(isolate);
     v8::Local<v8::Value> arg = args[0];
     v8::String::Utf8Value value(isolate, arg);
-    mylog("sendMessageCallback called, yay!");
 
-    v8::Local<v8::Object> data = v8::Local<v8::Object>::Cast(args.Data());
-
-    mylog("getting instance");
-    NativeAkonoInstance *myInstance = (NativeAkonoInstance *) 
data->GetAlignedPointerFromInternalField(0);
-
-    JNIEnv *env = myInstance->currentJniEnv;
+    JNIEnv *env;
 
-    if (env == nullptr) {
-        mylog("FATAL: JNI env is nullptr");
+    if (JNI_OK != myInstance->javaVm->GetEnv((void **) &env, JNI_VERSION_1_6)) 
{
+        mylog("FATAL ERROR: could not get JVM env handle");
         return;
     }
 
-    mylog("finding class");
     jclass clazz = env->FindClass("akono/AkonoJni");
 
     if (clazz == nullptr) {
@@ -484,11 +470,8 @@ static void loadModuleCallback(const 
v8::FunctionCallbackInfo<v8::Value> &args)
         return;
     }
 
-    mylog("creating strings");
     jstring jstr1 = env->NewStringUTF(*value);
 
-    mylog("getting method");
-
     jmethodID meth = env->GetMethodID(clazz, "internalOnModuleLoad", 
"(Ljava/lang/String;)Ljava/lang/String;");
 
     if (meth == nullptr) {
@@ -496,8 +479,6 @@ static void loadModuleCallback(const 
v8::FunctionCallbackInfo<v8::Value> &args)
         return;
     }
 
-    mylog("calling method");
-
     jstring jresult = (jstring) 
env->CallObjectMethod(myInstance->currentJniThiz, meth, jstr1);
 
     JStringValue resultStringValue(env, jresult);
@@ -513,24 +494,24 @@ static void loadModuleCallback(const 
v8::FunctionCallbackInfo<v8::Value> &args)
 
 
 static void getDataCallback(const v8::FunctionCallbackInfo<v8::Value> &args) {
+    NativeAkonoInstance *myInstance = NativeAkonoInstance::getInstance();
+    v8::Locker v8Locker(myInstance->isolate);
     if (args.Length() < 1) return;
     v8::Isolate *isolate = args.GetIsolate();
     v8::HandleScope scope(isolate);
     v8::Local<v8::Value> arg = args[0];
     v8::String::Utf8Value value(isolate, arg);
-    mylog("getDataCallback called");
 
     v8::Local<v8::Object> data = v8::Local<v8::Object>::Cast(args.Data());
-    mylog("getting instance");
-    NativeAkonoInstance *myInstance = (NativeAkonoInstance *) 
data->GetAlignedPointerFromInternalField(0);
 
-    JNIEnv *env = myInstance->currentJniEnv;
-    if (env == nullptr) {
-        mylog("FATAL: JNI env is nullptr");
+    JNIEnv *env;
+
+    if (JNI_OK != myInstance->javaVm->GetEnv((void **) &env, JNI_VERSION_1_6)) 
{
+        mylog("FATAL ERROR: could not get JVM env handle");
         return;
     }
 
-    mylog("finding class");
+
     jclass clazz = env->FindClass("akono/AkonoJni");
 
     if (clazz == nullptr) {
@@ -538,11 +519,8 @@ static void getDataCallback(const 
v8::FunctionCallbackInfo<v8::Value> &args) {
         return;
     }
 
-    mylog("creating strings");
     jstring jstr1 = env->NewStringUTF(*value);
 
-    mylog("getting method");
-
     jmethodID meth = env->GetMethodID(clazz, "internalOnGetData", 
"(Ljava/lang/String;)Ljava/lang/String;");
 
     if (meth == nullptr) {
@@ -550,8 +528,6 @@ static void getDataCallback(const 
v8::FunctionCallbackInfo<v8::Value> &args) {
         return;
     }
 
-    mylog("calling method");
-
     jstring jresult = (jstring) 
env->CallObjectMethod(myInstance->currentJniThiz, meth, jstr1);
 
     JStringValue resultStringValue(env, jresult);
@@ -566,45 +542,45 @@ static void getDataCallback(const 
v8::FunctionCallbackInfo<v8::Value> &args) {
 }
 
 
-extern "C" JNIEXPORT jobject JNICALL
+extern "C" JNIEXPORT void JNICALL
 Java_akono_AkonoJni_initNative(JNIEnv *env, jobject thiz) {
-    NativeAkonoInstance *myInstance = new NativeAkonoInstance();
-    return env->NewDirectByteBuffer(myInstance, 0);
+    NativeAkonoInstance *myInstance = NativeAkonoInstance::getInstance();
+    if (nullptr != myInstance->currentJniThiz) {
+        env->DeleteGlobalRef(myInstance->currentJniThiz);
+    }
+    myInstance->currentJniThiz = env->NewGlobalRef(thiz);
+    if (0 != env->GetJavaVM(&myInstance->javaVm))
+        mylog("FATAL ERROR: could not get Java VM");
 }
 
 
 extern "C" JNIEXPORT void JNICALL
-Java_akono_AkonoJni_destroyNative(JNIEnv *env, jobject thiz, jobject buf) {
-    NativeAkonoInstance *myInstance = (NativeAkonoInstance *) 
env->GetDirectBufferAddress(buf);
-    delete myInstance;
+Java_akono_AkonoJni_destroyNative(JNIEnv *env, jobject thiz) {
+    // FIXME: not implemented
 }
 
 
 extern "C" JNIEXPORT jstring JNICALL
-Java_akono_AkonoJni_evalJs(JNIEnv *env, jobject thiz, jstring sourceStr, 
jobject buf) {
-    NativeAkonoInstance *myInstance = (NativeAkonoInstance *) 
env->GetDirectBufferAddress(buf);
+Java_akono_AkonoJni_evalJs(JNIEnv *env, jobject thiz, jstring sourceStr) {
+    NativeAkonoInstance *myInstance = NativeAkonoInstance::getInstance();
     return myInstance->evalJs(env, sourceStr);
 }
 
 extern "C" JNIEXPORT void JNICALL
-Java_akono_AkonoJni_notifyNative(JNIEnv *env, jobject thiz, jobject buf) {
-    NativeAkonoInstance *myInstance = (NativeAkonoInstance *) 
env->GetDirectBufferAddress(buf);
+Java_akono_AkonoJni_notifyNative(JNIEnv *env, jobject thiz) {
+    NativeAkonoInstance *myInstance = NativeAkonoInstance::getInstance();
     uv_async_send(&myInstance->async_notify);
 }
 
 extern "C" JNIEXPORT void JNICALL
-Java_akono_AkonoJni_runNode(JNIEnv *env, jobject thiz, jobject buf) {
-    NativeAkonoInstance *myInstance = (NativeAkonoInstance *) 
env->GetDirectBufferAddress(buf);
-    myInstance->currentJniEnv = env;
-    myInstance->currentJniThiz = thiz;
+Java_akono_AkonoJni_runNode(JNIEnv *env, jobject thiz) {
+    NativeAkonoInstance *myInstance =NativeAkonoInstance::getInstance();
     myInstance->runNode();
 }
 
 extern "C" JNIEXPORT void JNICALL
-Java_akono_AkonoJni_makeCallbackNative(JNIEnv *env, jobject thiz, jstring 
sourceStr, jobject buf) {
+Java_akono_AkonoJni_makeCallbackNative(JNIEnv *env, jobject thiz, jstring 
sourceStr) {
     JStringValue jsv(env, sourceStr);
-    NativeAkonoInstance *myInstance = (NativeAkonoInstance *) 
env->GetDirectBufferAddress(buf);
-    myInstance->currentJniEnv = env;
-    myInstance->currentJniThiz = thiz;
+    NativeAkonoInstance *myInstance = NativeAkonoInstance::getInstance();
     return myInstance->makeCallback(*jsv);
 }
diff --git a/akono/src/main/java/akono/AkonoJni.kt 
b/akono/src/main/java/akono/AkonoJni.kt
index 0ba31ee8..ef867a85 100644
--- a/akono/src/main/java/akono/AkonoJni.kt
+++ b/akono/src/main/java/akono/AkonoJni.kt
@@ -3,16 +3,14 @@ package akono
 import android.util.Base64
 import android.util.Log
 import org.json.JSONObject
-import java.lang.Exception
-import java.nio.ByteBuffer
 import java.util.concurrent.CountDownLatch
 import java.util.concurrent.LinkedBlockingDeque
 import kotlin.concurrent.thread
 
-typealias AkonoNativePointer = ByteBuffer
-
 data class ModuleResult(val path: String, val contents: String)
 
+const val TAG = "AkonoJni"
+
 class AkonoJni(vararg nodeArgv: String) {
     private var getDataHandler: GetDataHandler? = null
     private var messageHandler: MessageHandler? = null
@@ -21,16 +19,15 @@ class AkonoJni(vararg nodeArgv: String) {
 
     private val workQueue = LinkedBlockingDeque<() -> Unit>()
 
-    private external fun evalJs(source: String, p: AkonoNativePointer): String
-    private external fun runNode(p: AkonoNativePointer)
+    private external fun evalJs(source: String): String
+    private external fun runNode()
 
-    private external fun makeCallbackNative(source: String, p: 
AkonoNativePointer)
+    private external fun makeCallbackNative(source: String)
 
-    private external fun destroyNative(b: AkonoNativePointer)
-    private external fun initNative(nodeArgv: Array<out String>): 
AkonoNativePointer
-    private external fun notifyNative(b: AkonoNativePointer)
+    private external fun destroyNative()
+    private external fun initNative(nodeArgv: Array<out String>)
+    private external fun notifyNative()
 
-    private lateinit var internalNativePointer: AkonoNativePointer
 
     private val jniThread: Thread
 
@@ -49,19 +46,22 @@ class AkonoJni(vararg nodeArgv: String) {
      * Called by node/v8 from its thread.
      */
     @Suppress("unused")
-    private fun internalOnNotify(type: String, payload: String) {
-        messageHandler?.handleMessage(payload)
+    private fun internalOnNotify(payload: String) {
+        try {
+            messageHandler?.handleMessage(payload)
+        } catch (e: Throwable) {
+            Log.e(TAG, "unexpected exception in message handler", e)
+        }
     }
 
     /**
      * Called by node/v8 from its thread.
      */
     @Suppress("unused")
-    private fun internalOnModuleLoad(loadInfoStr: String): String {
+    private fun internalOnModuleLoad(loadInfoStr: String): String? {
         try {
             val loadInfo = JSONObject(loadInfoStr)
             val request: String = loadInfo.getString("request")
-            Log.i("myapp", "request is $request")
             val paths = ArrayList<String>()
             val pathsJson = loadInfo.getJSONArray("paths")
             for (i in 0 until pathsJson.length()) {
@@ -79,12 +79,12 @@ class AkonoJni(vararg nodeArgv: String) {
                 result.put("content", modResult.contents)
                 return result.toString()
             } else {
-                Log.w("myapp", "no module load handler registered")
-                return "null"
+                Log.w(TAG, "no module load handler registered")
+                return null
             }
-        } catch (e: Exception) {
-            Log.e("myapp", "exception during internalOnModuleLoad: $e")
-            return "null"
+        } catch (e: Throwable) {
+            Log.e(TAG, "exception during internalOnModuleLoad", e)
+            return null
         }
     }
 
@@ -93,13 +93,18 @@ class AkonoJni(vararg nodeArgv: String) {
      */
     @Suppress("unused")
     private fun internalOnGetData(what: String): String? {
-        val data = getDataHandler?.handleGetData(what) ?: return null
-        return Base64.encodeToString(data, Base64.NO_WRAP)
+        try {
+            val data = getDataHandler?.handleGetData(what) ?: return null
+            return Base64.encodeToString(data, Base64.NO_WRAP)
+        } catch (e: Throwable) {
+            Log.e(TAG, "exception during internalOnGetData", e)
+        }
+        return null
     }
 
-    fun notifyNative() {
+    fun sendNotify() {
         initializedLatch.await()
-        notifyNative(internalNativePointer)
+        notifyNative()
     }
 
     /**
@@ -109,7 +114,7 @@ class AkonoJni(vararg nodeArgv: String) {
         val latch = CountDownLatch(1)
         var result: String? = null
         scheduleNodeThread {
-            result = evalJs(source, internalNativePointer)
+            result = evalJs(source)
             latch.countDown()
         }
         latch.await()
@@ -118,7 +123,7 @@ class AkonoJni(vararg nodeArgv: String) {
 
     fun evalNodeCode(source: String) {
         scheduleNodeThread {
-            makeCallbackNative(source, internalNativePointer)
+            makeCallbackNative(source)
         }
     }
 
@@ -142,7 +147,7 @@ class AkonoJni(vararg nodeArgv: String) {
      *
      */
     fun waitStopped(): Unit {
-        Log.i("myapp", "waiting for stop")
+        Log.i(TAG, "waiting for stop")
         scheduleNodeThread {
             stopped = true
         }
@@ -170,15 +175,15 @@ class AkonoJni(vararg nodeArgv: String) {
 
     @Override
     protected fun finalize() {
-        destroyNative(internalNativePointer)
+        destroyNative()
     }
 
     init {
         jniThread = thread {
-            internalNativePointer = initNative(nodeArgv)
+            initNative(nodeArgv)
             initializedLatch.countDown()
             while (true) {
-                runNode(internalNativePointer)
+                runNode()
                 while (true) {
                     val w = workQueue.poll() ?: break
                     w()
@@ -191,7 +196,6 @@ class AkonoJni(vararg nodeArgv: String) {
     }
 
     companion object {
-
         init {
             System.loadLibrary("akono-jni")
         }

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]