public abstract class AbstractCloseableReferenceCounted extends AbstractReferenceCounted implements ManagedCloseable
referenceCounted, WARN_COUNT, WARN_NSINIT, TMP| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCloseableReferenceCounted() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
backgroundPerformRelease() |
void |
close()
Closes this resource, potentially preventing parts of it from being used again
and potentially relinquishing resources held.
|
boolean |
isClosed()
Is this object closed
|
void |
release(ReferenceOwner id)
Releases a resource.
|
void |
releaseLast(ReferenceOwner id)
Releases a resource and checks this is the last usage.
|
void |
reserve(ReferenceOwner id)
Reserves a resource or throws an Exception.
|
void |
reserveTransfer(ReferenceOwner from,
ReferenceOwner to) |
protected void |
setClosed()
When actually closed.
|
protected void |
setClosing()
Set closing in case it is being released in the background.
|
void |
throwExceptionIfClosed() |
protected void |
throwExceptionIfClosedInSetter() |
boolean |
tryReserve(ReferenceOwner id)
Tries to reserve a resource and returns if the resource could
be successfully reserved.
|
assertReferencesReleased, canReleaseInBackground, clearUsedByThread, createdHere, disableReferenceTracing, enableReferenceTracing, performRelease, refCount, referenceId, reservedBy, threadSafetyCheck, throwExceptionIfNotReleased, throwExceptionIfReleased, toString, unmonitor, warnAndReleaseIfNotReleasedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreatedHere, warnAndCloseIfNotClosedcloseQuietly, closeQuietlyisClosingonReleasedreleaseLastreferenceName, temporarypublic void reserve(ReferenceOwner id) throws IllegalStateException
ReferenceCountedEach invocation of this method increases the reference count by one.
reserve in interface ReferenceCountedreserve in class AbstractReferenceCountedid - unique id for this reserveIllegalStateException - if the resource has already been freed.
I.e. its reference counter has as some point reached zero.public void reserveTransfer(ReferenceOwner from, ReferenceOwner to) throws IllegalStateException
reserveTransfer in interface ReferenceCountedreserveTransfer in class AbstractReferenceCountedIllegalStateExceptionpublic void release(ReferenceOwner id) throws IllegalStateException
ReferenceCountedEach invocation of this method decreases the reference count by one.
release in interface ReferenceCountedrelease in class AbstractReferenceCountedid - unique id for the reserve to be releasedIllegalStateException - if the resource has already been freed.
I.e. its reference counter has as some point reached zero.public void releaseLast(ReferenceOwner id) throws IllegalStateException
ReferenceCountedEach invocation of this method decreases the reference count by one.
releaseLast in interface ReferenceCountedreleaseLast in class AbstractReferenceCountedid - unique id for the reserve to be releasedIllegalStateException - if the resource has already been freed.
I.e. its reference counter has as some point reached zero.public boolean tryReserve(ReferenceOwner id) throws IllegalStateException, IllegalArgumentException
ReferenceCountedEach invocation of this method increases the reference count by one.
tryReserve in interface ReferenceCountedtryReserve in class AbstractReferenceCountedid - unique id for this reserveIllegalStateException - if the resource has already been freed.
I.e. its reference counter has as some point reached zero.IllegalArgumentExceptionpublic void close()
CloseableThis method is idem-potent.
close in interface Closeableclose in interface AutoCloseableprotected void backgroundPerformRelease()
backgroundPerformRelease in class AbstractReferenceCountedprotected void setClosing()
protected void setClosed()
public void throwExceptionIfClosed()
throws IllegalStateException
throwExceptionIfClosed in interface ManagedCloseableIllegalStateExceptionprotected void throwExceptionIfClosedInSetter()
throws IllegalStateException
IllegalStateExceptionpublic boolean isClosed()
QueryCloseableisClosed in interface QueryCloseableCopyright © 2022. All rights reserved.