Package org.apache.lucene.util
Class RefCount<T>
- java.lang.Object
-
- org.apache.lucene.util.RefCount<T>
-
public class RefCount<T> extends java.lang.Object
Manages reference counting for a given object. Extensions can overriderelease()
to do custom logic when reference counting hits 0.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
decRef()
Decrements the reference counting of this object.T
get()
int
getRefCount()
Returns the current reference count.void
incRef()
Increments the reference count.
-
-
-
Constructor Detail
-
RefCount
public RefCount(T object)
-
-
Method Detail
-
decRef
public final void decRef() throws java.io.IOException
Decrements the reference counting of this object. When reference counting hits 0, callsrelease()
.- Throws:
java.io.IOException
-
get
public final T get()
-
getRefCount
public final int getRefCount()
Returns the current reference count.
-
incRef
public final void incRef()
Increments the reference count. Calls to this method must be matched with calls todecRef()
.
-
-