19 private static final class CppProxy
extends Logger
21 private final long nativeRef;
22 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
24 private CppProxy(
long nativeRef)
26 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
27 this.nativeRef = nativeRef;
30 private native
void nativeDestroy(
long nativeRef);
31 public void _djinni_private_destroy()
33 boolean destroyed = this.destroyed.getAndSet(
true);
34 if (!destroyed) nativeDestroy(this.nativeRef);
36 protected void finalize() throws java.lang.Throwable
38 _djinni_private_destroy();
47 assert !this.destroyed.get() :
"trying to use a destroyed object";
48 native_subscribe(this.nativeRef, listener);
50 private native
void native_subscribe(
long _nativeRef,
LogListener listener);
55 assert !this.destroyed.get() :
"trying to use a destroyed object";
56 native_unsubscribe(this.nativeRef, listener);
58 private native
void native_unsubscribe(
long _nativeRef, LogListener listener);
60 public static native Logger getLogger();