Package org.apache.solr.util
Class RefCounted<Type>
- java.lang.Object
- 
- org.apache.solr.util.RefCounted<Type>
 
- 
 public abstract class RefCounted<Type> extends Object 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 SummaryFields Modifier and Type Field Description protected AtomicIntegerrefcountprotected Typeresource
 - 
Constructor SummaryConstructors Constructor Description RefCounted(Type resource)
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidclose()voiddecref()Typeget()intgetRefcount()RefCounted<Type>incref()
 
- 
- 
- 
Field Detail- 
resourceprotected final Type resource 
 - 
refcountprotected final AtomicInteger refcount 
 
- 
 - 
Constructor Detail- 
RefCountedpublic RefCounted(Type resource) 
 
- 
 - 
Method Detail- 
getRefcountpublic int getRefcount() 
 - 
increfpublic final RefCounted<Type> incref() 
 - 
getpublic final Type get() 
 - 
decrefpublic void decref() 
 - 
closeprotected abstract void close() 
 
- 
 
-