Skip to content

v0.2.55..v0.2.56 changeset JavaEnvironment.h

Garret Voltz edited this page Aug 14, 2020 · 3 revisions
diff --git a/hoot-josm/src/main/cpp/hoot/core/jni/JavaEnvironment.h b/hoot-josm/src/main/cpp/hoot/core/jni/JavaEnvironment.h
index 01f1f59..2549ae2 100644
--- a/hoot-josm/src/main/cpp/hoot/core/jni/JavaEnvironment.h
+++ b/hoot-josm/src/main/cpp/hoot/core/jni/JavaEnvironment.h
@@ -36,10 +36,6 @@
 namespace hoot
 {
 
-class JavaEnvironment;
-
-typedef std::shared_ptr<JavaEnvironment> JavaEnvironmentPtr;
-
 /**
  * Creates a Java Virtual Machine for use by Hootenanny C++ code that calls Java code in the
  * hoot-josm library via JNI (Singleton)
@@ -55,22 +51,20 @@ public:
 
   static std::string className() { return "hoot::JavaEnvironment"; }
 
-  ~JavaEnvironment();
+  virtual ~JavaEnvironment();
+
+  static JavaEnvironment& getInstance();
 
   /**
-   * Creates a single instance of a JNI environment if none yet exists and returns it.
-   *
+   * Returns single instance of a JNI environment
    * @return a pointer to a JNI environment
    */
-  static JNIEnv* getEnvironment() { return getInstance()->_env; }
-
-  static const JavaEnvironmentPtr& getInstance();
+  JNIEnv* getEnvironment() { return _env; }
 
 private:
 
   JavaEnvironment();
 
-  static JavaEnvironmentPtr _theInstance;
   // A Java VM; is destroyed by this class in the destructor
   JavaVM* _vm;
   // A JNI environment
Clone this wiki locally