org.hibernate.search.backend.impl.lucene

## Class MultiWriteDrainableLinkedList<T>

- java.lang.Object
- - org.hibernate.search.backend.impl.lucene.MultiWriteDrainableLinkedList<T>

-     public final class MultiWriteDrainableLinkedList<T>
      extends Object

  A custom structure similar to a concurrent linked list. This could be functionally replaced by a LinkedBlockingDeque, but we only need a specific subset of its functionality. Specifically, we need to maintain the order of elements being added, but on a drain we'll only ever need to iterate the list sequentially, and the drain needs to atomically reset the queue.
  Since:
    5.0
  Author:
    Sanne Grinovero (C) 2014 Red Hat Inc.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MultiWriteDrainableLinkedList()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(T element)` Adds a new entry to this list.
    `Iterable<T>` | `drainToDetachedIterable()` Returns an Iterable over all results added so far, but atomically clears the structure as well.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MultiWriteDrainableLinkedList

          public MultiWriteDrainableLinkedList()

  - ### Method Detail

    - #### add

          public void add(T element)

      Adds a new entry to this list.
      Parameters:
        `element` - The element to add.

    - #### drainToDetachedIterable

          public Iterable<T> drainToDetachedIterable()

      Returns an Iterable over all results added so far, but atomically clears the structure as well. The returned iterable will be the only entry point to read the previously appended data.
      Returns:
        an Iterable, or null if there is no data.

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved