org.apache.lucene.gdata.utils
Class ReferenceCounter<Type>

java.lang.Object
  extended by org.apache.lucene.gdata.utils.ReferenceCounter<Type>
Type Parameters:
Type - - the type of the object

public abstract class ReferenceCounter<Type>
extends Object

A reference counting utility. This is use to keep track of released objects of Type.

Author:
Simon Willnauer

Field Summary
protected  Type resource
           
 
Constructor Summary
ReferenceCounter(Type resource)
           
 
Method Summary
protected abstract  void close()
          A custom implementation.
 void decrementRef()
          Decrements the reference.
 Type get()
           
 ReferenceCounter<Type> increamentReference()
          Increments the reference
 
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
Constructor Detail

ReferenceCounter

public ReferenceCounter(Type resource)
Parameters:
resource - - the resource to track
Method Detail

decrementRef

public final void decrementRef()
Decrements the reference. If no references remain the close() method will be invoked;


close

protected abstract void close()
A custom implementation. Performs an action if no reference remaining


increamentReference

public final ReferenceCounter<Type> increamentReference()
Increments the reference

Returns:
the reference object

get

public final Type get()
Returns:
- the resource to keep track of


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.