org.apache.lucene.util
Class BytesRefHash.TrackingDirectBytesStartArray

java.lang.Object
  extended by org.apache.lucene.util.BytesRefHash.BytesStartArray
      extended by org.apache.lucene.util.BytesRefHash.TrackingDirectBytesStartArray
Enclosing class:
BytesRefHash

public static class BytesRefHash.TrackingDirectBytesStartArray
extends BytesRefHash.BytesStartArray

A simple BytesRefHash.BytesStartArray that tracks all memory allocation using a shared AtomicLong instance.


Field Summary
protected  AtomicLong bytesUsed
           
protected  int initSize
           
 
Constructor Summary
BytesRefHash.TrackingDirectBytesStartArray(int initSize, AtomicLong bytesUsed)
           
 
Method Summary
 AtomicLong bytesUsed()
          A AtomicLong reference holding the number of bytes used by this BytesRefHash.BytesStartArray.
 int[] clear()
          clears the BytesRefHash.BytesStartArray and returns the cleared instance.
 int[] grow()
          Grows the BytesRefHash.BytesStartArray
 int[] init()
          Initializes the BytesStartArray.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initSize

protected final int initSize

bytesUsed

protected final AtomicLong bytesUsed
Constructor Detail

BytesRefHash.TrackingDirectBytesStartArray

public BytesRefHash.TrackingDirectBytesStartArray(int initSize,
                                                  AtomicLong bytesUsed)
Method Detail

clear

public int[] clear()
Description copied from class: BytesRefHash.BytesStartArray
clears the BytesRefHash.BytesStartArray and returns the cleared instance.

Specified by:
clear in class BytesRefHash.BytesStartArray
Returns:
the cleared instance, this might be null

grow

public int[] grow()
Description copied from class: BytesRefHash.BytesStartArray
Grows the BytesRefHash.BytesStartArray

Specified by:
grow in class BytesRefHash.BytesStartArray
Returns:
the grown array

init

public int[] init()
Description copied from class: BytesRefHash.BytesStartArray
Initializes the BytesStartArray. This call will allocate memory

Specified by:
init in class BytesRefHash.BytesStartArray
Returns:
the initialized bytes start array

bytesUsed

public AtomicLong bytesUsed()
Description copied from class: BytesRefHash.BytesStartArray
A AtomicLong reference holding the number of bytes used by this BytesRefHash.BytesStartArray. The BytesRefHash uses this reference to track it memory usage

Specified by:
bytesUsed in class BytesRefHash.BytesStartArray
Returns:
a AtomicLong reference holding the number of bytes used by this BytesRefHash.BytesStartArray.