70 private final long nativeRef;
71 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
73 private CppProxy(
long nativeRef)
75 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
76 this.nativeRef = nativeRef;
79 private native
void nativeDestroy(
long nativeRef);
80 public void _djinni_private_destroy()
82 boolean destroyed = this.destroyed.getAndSet(
true);
83 if (!destroyed) nativeDestroy(this.nativeRef);
85 protected void finalize() throws
java.lang.Throwable
87 _djinni_private_destroy();
94 public ArrayList<String> getStorageList()
96 assert !this.destroyed.get() :
"trying to use a destroyed object";
97 return native_getStorageList(this.nativeRef);
99 private native ArrayList<String> native_getStorageList(
long _nativeRef);
104 assert !this.destroyed.get() :
"trying to use a destroyed object";
105 return native_getStorage(this.nativeRef, name);
107 private native
KeyValueStorage native_getStorage(
long _nativeRef, String name);
110 public void removeStorage(String name)
112 assert !this.destroyed.get() :
"trying to use a destroyed object";
113 native_removeStorage(this.nativeRef, name);
115 private native
void native_removeStorage(
long _nativeRef, String name);