void release(boolean leak) { if (!releasedUpdater.compareAndSet(this, 0, 1)) { if (!leak) { String id = this.toString(); logger.info("BAD RELEASE: attempted to release a reference ({}) that has already been released", id); if (DEBUG_ENABLED) debug.log(id); //throw new IllegalStateException("Attempted to release a reference that has already been released"); } return; } Throwable fail = globalState.release(this, null); if (leak) { String id = this.toString(); logger.error("LEAK DETECTED: a reference ({}) to {} was not released before the reference was garbage collected", id, globalState); if (DEBUG_ENABLED) debug.log(id); } else if (DEBUG_ENABLED) { debug.deallocate(); } if (fail != null) logger.error("Error when closing {}", globalState, fail); } }
void release(boolean leak) { if (!releasedUpdater.compareAndSet(this, 0, 1)) { if (!leak) { String id = this.toString(); logger.error("BAD RELEASE: attempted to release a reference ({}) that has already been released", id); if (DEBUG_ENABLED) debug.log(id); throw new IllegalStateException("Attempted to release a reference that has already been released"); } return; } Throwable fail = globalState.release(this, null); if (leak) { String id = this.toString(); logger.error("LEAK DETECTED: a reference ({}) to {} was not released before the reference was garbage collected", id, globalState); if (DEBUG_ENABLED) debug.log(id); } else if (DEBUG_ENABLED) { debug.deallocate(); } if (fail != null) logger.error("Error when closing {}", globalState, fail); } }
void release(boolean leak) { if (!releasedUpdater.compareAndSet(this, 0, 1)) { if (!leak) { String id = this.toString(); logger.error("BAD RELEASE: attempted to release a reference ({}) that has already been released", id); if (DEBUG_ENABLED) debug.log(id); throw new IllegalStateException("Attempted to release a reference that has already been released"); } return; } globalState.release(this); if (leak) { String id = this.toString(); logger.error("LEAK DETECTED: a reference ({}) to {} was not released before the reference was garbage collected", id, globalState); if (DEBUG_ENABLED) debug.log(id); } else if (DEBUG_ENABLED) { debug.deallocate(); } } }
void release(boolean leak) { if (!releasedUpdater.compareAndSet(this, 0, 1)) { if (!leak) { String id = this.toString(); logger.error("BAD RELEASE: attempted to release a reference ({}) that has already been released", id); if (DEBUG_ENABLED) debug.log(id); throw new IllegalStateException("Attempted to release a reference that has already been released"); } return; } Throwable fail = globalState.release(this, null); if (leak) { String id = this.toString(); logger.error("LEAK DETECTED: a reference ({}) to {} was not released before the reference was garbage collected", id, globalState); if (DEBUG_ENABLED) debug.log(id); } else if (DEBUG_ENABLED) { debug.deallocate(); } if (fail != null) logger.error("Error when closing {}", globalState, fail); } }
void release(boolean leak) { if (!releasedUpdater.compareAndSet(this, 0, 1)) { if (!leak) { String id = this.toString(); logger.error("BAD RELEASE: attempted to release a reference ({}) that has already been released", id); if (DEBUG_ENABLED) debug.log(id); throw new IllegalStateException("Attempted to release a reference that has already been released"); } return; } Throwable fail = globalState.release(this, null); if (leak) { String id = this.toString(); logger.error("LEAK DETECTED: a reference ({}) to {} was not released before the reference was garbage collected", id, globalState); if (DEBUG_ENABLED) debug.log(id); } else if (DEBUG_ENABLED) { debug.deallocate(); } if (fail != null) logger.error("Error when closing {}", globalState, fail); } }
public Ref<T> tryRef() { return state.globalState.ref() ? new Ref<>(referent, state.globalState) : null; }
public Ref<T> tryRef() { return state.globalState.ref() ? new Ref<>(referent, state.globalState) : null; }
public Ref<T> tryRef() { return state.globalState.ref() ? new Ref<>(referent, state.globalState) : null; }
public Ref<T> tryRef() { return state.globalState.ref() ? new Ref<>(referent, state.globalState) : null; }
public State(final GlobalState globalState, Ref reference, ReferenceQueue<? super Ref> q) { super(reference, q); this.globalState = globalState; globalState.register(this); }
/** * A convenience method for reporting: * @return the number of currently extant references globally, including the shared reference */ public int globalCount() { return state.globalState.count(); }
/** * A convenience method for reporting: * @return the number of currently extant references globally, including the shared reference */ public int globalCount() { return state.globalState.count(); }
/** * A convenience method for reporting: * @return the number of currently extant references globally, including the shared reference */ public int globalCount() { return state.globalState.count(); }
public Ref(T referent, Tidy tidy) { this.state = new State(new GlobalState(tidy), this, referenceQueue); this.referent = referent; }
public State(final GlobalState globalState, Ref reference, ReferenceQueue<? super Ref> q) { super(reference, q); this.globalState = globalState; globalState.register(this); }
public Ref(T referent, Tidy tidy) { this.state = new State(new GlobalState(tidy), this, referenceQueue); this.referent = referent; }
Throwable ensureReleased(Throwable accumulate) { if (releasedUpdater.getAndSet(this, 1) == 0) { accumulate = globalState.release(this, accumulate); if (DEBUG_ENABLED) debug.deallocate(); } return accumulate; }
public State(final GlobalState globalState, Ref reference, ReferenceQueue<? super Ref> q) { super(reference, q); this.globalState = globalState; globalState.register(this); }
public Ref(T referent, Tidy tidy) { this.state = new State(new GlobalState(tidy), this, referenceQueue); this.referent = referent; }
public Ref(T referent, Tidy tidy) { this.state = new State(new GlobalState(tidy), this, referenceQueue); this.referent = referent; }