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.lucene.facet.search
Class FloatArrayAllocator

    java.lang.Object
      org.apache.lucene.facet.search.TemporaryObjectAllocator<float[]>
          org.apache.lucene.facet.search.FloatArrayAllocator

    public final class FloatArrayAllocator

extends TemporaryObjectAllocator<float[]>

An FloatArrayAllocator is an object which manages float array objects of a certain size. These float arrays are needed temporarily during faceted search (see `FacetsAccumulator` and can be reused across searches instead of being allocated afresh on every search.

An FloatArrayAllocator is thread-safe.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Constructor Summary
`FloatArrayAllocator(int size, int maxArrays)` Construct an allocator for float arrays of size `size`, keeping around a pool of up to `maxArrays` old arrays.

Method Summary
`void` | `clear(float[] array)` Subclasses must override this method to clear an existing object of the desired type, to prepare it for reuse.
`float[]` | `create()` Subclasses must override this method to actually create a new object of the desired type.

Methods inherited from class org.apache.lucene.facet.search.TemporaryObjectAllocator
`allocate, free`

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

Constructor Detail

### FloatArrayAllocator

    public FloatArrayAllocator(int size,
                               int maxArrays)

  Construct an allocator for float arrays of size `size`, keeping around a pool of up to `maxArrays` old arrays.

  Note that the pool size only restricts the number of arrays that hang around when not needed, but not the maximum number of arrays that are allocated when actually is use: If a number of concurrent threads ask for an allocation, all of them will get a counter array, even if their number is greater than maxArrays. If an application wants to limit the number of concurrent threads making allocations, it needs to do so on its own - for example by blocking new threads until the existing ones have finished.

  In particular, when maxArrays=0, this object behaves as a trivial allocator, always allocating a new array and never reusing an old one.

Method Detail

### create

    public float[] create()

  Description copied from class: `TemporaryObjectAllocator`
  Subclasses must override this method to actually create a new object of the desired type.

  Specified by:
    `create` in class `TemporaryObjectAllocator<float[]>`

### clear

    public void clear(float[] array)

  Description copied from class: `TemporaryObjectAllocator`
  Subclasses must override this method to clear an existing object of the desired type, to prepare it for reuse. Note that objects will be cleared just before reuse (on allocation), not when freed.

  Specified by:
    `clear` in class `TemporaryObjectAllocator<float[]>`

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