public abstract class AbstractCloseableReferenceCounted extends AbstractReferenceCounted implements CloseableTracer
WARN_COUNT, WARN_NS
INIT
Constructor and Description |
---|
AbstractCloseableReferenceCounted() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Doesn't throw a checked exception.
|
boolean |
isClosed() |
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() |
void |
throwExceptionIfClosed() |
protected void |
throwExceptionIfClosedInSetter() |
boolean |
tryReserve(ReferenceOwner id)
Tries to reserve a resource and returns if the resource could
be successfully reserved.
|
assertReferencesReleased, createdHere, disableReferenceTracing, enableReferenceTracing, performRelease, performReleaseInBackground, refCount, referenceId, reservedBy, threadSafetyCheck, throwExceptionIfNotReleased, throwExceptionIfReleased, toString, unmonitor, warnAndReleaseIfNotReleased
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createdHere
closeQuietly, closeQuietly, notifyClosing
isClosing
onReleased
releaseLast
referenceName, temporary
public void reserve(ReferenceOwner id) throws IllegalStateException
ReferenceCounted
Each invocation of this method increases the reference count by one.
reserve
in interface ReferenceCounted
reserve
in class AbstractReferenceCounted
id
- 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 ReferenceCounted
reserveTransfer
in class AbstractReferenceCounted
IllegalStateException
public void release(ReferenceOwner id) throws IllegalStateException
ReferenceCounted
Each invocation of this method decreases the reference count by one.
release
in interface ReferenceCounted
release
in class AbstractReferenceCounted
id
- 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
ReferenceCounted
Each invocation of this method decreases the reference count by one.
releaseLast
in interface ReferenceCounted
releaseLast
in class AbstractReferenceCounted
id
- 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
ReferenceCounted
Each invocation of this method increases the reference count by one.
tryReserve
in interface ReferenceCounted
tryReserve
in class AbstractReferenceCounted
id
- 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 close()
Closeable
close
in interface Closeable
close
in interface AutoCloseable
protected void setClosed()
public void throwExceptionIfClosed() throws IllegalStateException
throwExceptionIfClosed
in interface QueryCloseable
IllegalStateException
protected void throwExceptionIfClosedInSetter() throws IllegalStateException
IllegalStateException
public boolean isClosed()
isClosed
in interface QueryCloseable
Copyright © 2020. All rights reserved.