public abstract class ReferenceCountedBase extends java.lang.Object implements ReferenceCounted
ReferenceCounted| Modifier and Type | Field and Description |
|---|---|
static int |
traceHistorySize
Number of most-recent acquire/release events retained per object when
traceReferences is enabled. |
static boolean |
traceReferences
|
| Constructor and Description |
|---|
ReferenceCountedBase() |
| Modifier and Type | Method and Description |
|---|---|
ReferenceCountedBase |
acquire()
Signal the resource that something is holding a reference to it.
|
long |
acquireAndCount()
Signal the resource that something is holding a reference to it.
|
long |
getReferenceCount()
Number of active references
|
void |
release()
Signal the resource that a previous hold is complete
|
long |
releaseAndCount()
Signal the resource that a previous hold is complete.
|
public static boolean traceReferences
acquire()/release() records the calling
stack, and the full acquire/release history is dumped if the reference
count ever underflows. This makes it possible to pinpoint the two
colliding call sites (the extra release, and the acquire it should have
balanced against). Off by default since it adds per-call overhead and
synchronization; enable it while hunting a "didn't properly keep track of
releases" message. May be set via the system property
maspack.util.traceReferences=true.public static int traceHistorySize
traceReferences is enabled.public ReferenceCountedBase acquire()
ReferenceCountedacquire in interface ReferenceCountedpublic long acquireAndCount()
ReferenceCountedacquireAndCount in interface ReferenceCountedpublic long releaseAndCount()
ReferenceCountedreleaseAndCount in interface ReferenceCountedpublic void release()
ReferenceCountedrelease in interface ReferenceCountedpublic long getReferenceCount()
ReferenceCountedgetReferenceCount in interface ReferenceCounted