RefCounted (Solr 3.6.2 API)
Keywords: org.apache.solr.util.RefCounted class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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).

Version:
  $Id: RefCounted.java 779125 2009-05-27 11:58:18Z noble $

Field Summary
`protected AtomicInteger` | `refcount`
`protected Type` | `resource`

Constructor Summary
`RefCounted(Type resource)`

Method Summary
`protected abstract void` | `close()`
`void` | `decref()`
`Type` | `get()`
`int` | `getRefcount()`
`RefCounted<Type>` | `incref()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### resource

    protected final Type resource

### refcount

    protected final AtomicInteger refcount

Constructor Detail

### RefCounted

    public RefCounted(Type resource)

Method Detail

### getRefcount

    public int getRefcount()

### incref

    public final RefCounted<Type> incref()

### get

    public final Type get()

### decref

    public void decref()

### close

    protected abstract void close()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD