37 private final long nativeRef;
38 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
40 private CppProxy(
long nativeRef)
42 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
43 this.nativeRef = nativeRef;
46 private native
void nativeDestroy(
long nativeRef);
47 public void _djinni_private_destroy()
49 boolean destroyed = this.destroyed.getAndSet(
true);
50 if (!destroyed) nativeDestroy(this.nativeRef);
52 protected void finalize() throws
java.lang.Throwable
54 _djinni_private_destroy();
63 assert !this.destroyed.get() :
"trying to use a destroyed object";
64 native_addRouteListener(this.nativeRef, listener);
66 private native
void native_addRouteListener(
long _nativeRef,
AsyncRouteListener listener);
71 assert !this.destroyed.get() :
"trying to use a destroyed object";
72 native_removeRouteListener(this.nativeRef, listener);
74 private native
void native_removeRouteListener(
long _nativeRef,
AsyncRouteListener listener);