67 private final long nativeRef;
68 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
70 private CppProxy(
long nativeRef)
72 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
73 this.nativeRef = nativeRef;
76 private native
void nativeDestroy(
long nativeRef);
77 public void _djinni_private_destroy()
79 boolean destroyed = this.destroyed.getAndSet(
true);
80 if (!destroyed) nativeDestroy(this.nativeRef);
82 protected void finalize() throws
java.lang.Throwable
84 _djinni_private_destroy();
91 public ArrayList<String> getStorageList()
93 assert !this.destroyed.get() :
"trying to use a destroyed object";
94 return native_getStorageList(this.nativeRef);
96 private native ArrayList<String> native_getStorageList(
long _nativeRef);
101 assert !this.destroyed.get() :
"trying to use a destroyed object";
102 return native_getStorage(this.nativeRef, name);
104 private native
KeyValueStorage native_getStorage(
long _nativeRef, String name);
107 public void removeStorage(String name)
109 assert !this.destroyed.get() :
"trying to use a destroyed object";
110 native_removeStorage(this.nativeRef, name);
112 private native
void native_removeStorage(
long _nativeRef, String name);