42 private final long nativeRef;
43 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
45 private CppProxy(
long nativeRef)
47 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
48 this.nativeRef = nativeRef;
51 private native
void nativeDestroy(
long nativeRef);
52 public void _djinni_private_destroy()
54 boolean destroyed = this.destroyed.getAndSet(
true);
55 if (!destroyed) nativeDestroy(this.nativeRef);
57 protected void finalize() throws
java.lang.Throwable
59 _djinni_private_destroy();
68 assert !this.destroyed.get() :
"trying to use a destroyed object";
69 native_addNotificationListener(this.nativeRef, listener);
71 private native
void native_addNotificationListener(
long _nativeRef,
NotificationListener listener);
76 assert !this.destroyed.get() :
"trying to use a destroyed object";
77 native_removeNotificationListener(this.nativeRef, listener);
79 private native
void native_removeNotificationListener(
long _nativeRef,
NotificationListener listener);