Package org.apache.solr.util
Class RefCounted<Type>
java.lang.Object
org.apache.solr.util.RefCounted<Type>
Keep track of a reference count on a resource and close it when the count hits zero.
By itself, this class could have some race conditions since there is no synchronization between the refcount check and the close. Solr's use in reference counting searchers is safe since the count can only hit zero if it's unregistered (and hence incref() will not be called again on it).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
resource
-
refcount
-
-
Constructor Details
-
RefCounted
-
-
Method Details
-
getRefcount
public int getRefcount() -
incref
-
get
-
decref
public void decref() -
close
protected abstract void close()
-