58 private final long nativeRef;
59 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
61 private CppProxy(
long nativeRef)
63 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
64 this.nativeRef = nativeRef;
67 private native
void nativeDestroy(
long nativeRef);
68 public void _djinni_private_destroy()
70 boolean destroyed = this.destroyed.getAndSet(
true);
71 if (!destroyed) nativeDestroy(this.nativeRef);
73 protected void finalize() throws
java.lang.Throwable
75 _djinni_private_destroy();
84 assert !this.destroyed.get() :
"trying to use a destroyed object";
85 native_addNotificationListener(this.nativeRef, listener);
87 private native
void native_addNotificationListener(
long _nativeRef,
NotificationListener listener);
92 assert !this.destroyed.get() :
"trying to use a destroyed object";
93 native_removeNotificationListener(this.nativeRef, listener);
95 private native
void native_removeNotificationListener(
long _nativeRef,
NotificationListener listener);