uk.ac.starlink.table

## Class QueueTableSequence

- java.lang.Object
- - uk.ac.starlink.table.QueueTableSequence

- All Implemented Interfaces:
    TableSequence

      public class QueueTableSequence
      extends java.lang.Object
      implements TableSequence

  TableSequence implementation for concurrent use. Table load successes or failures may be added on one thread, and the sequence used from another. The `nextTable` method will block until a result is available.
  Since:
    27 Sep 2010

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `QueueTableSequence()` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addError(java.lang.Throwable error)` Adds a load error to the queue.
    `void` | `addTable(StarTable table)` Adds a table to the queue.
    `void` | `endSequence()` Indicates that no more load success or failure indications will be added by the queue writer.
    `StarTable` | `nextTable()` Returns the next table in the sequence, or null if the end of the sequence is reached.

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

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

- - ### Constructor Detail

    - #### QueueTableSequence

          public QueueTableSequence()

      Constructor.

  - ### Method Detail

    - #### addTable

          public void addTable(StarTable table)

      Adds a table to the queue. This will appear in the TableSequence as a table loadSuccess.
      Parameters:
        `table` - successfully loaded table

    - #### addError

          public void addError(java.lang.Throwable error)

      Adds a load error to the queue. This will appear in the TableSequence as a table loadFailure.
      Parameters:
        `error` - reason for unsuccessful table load attempt

    - #### endSequence

          public void endSequence()

      Indicates that no more load success or failure indications will be added by the queue writer. Must be called, otherwise the reader will never terminate.

    - #### nextTable

          public StarTable nextTable()
                              throws java.io.IOException

      Description copied from interface: `TableSequence`
      Returns the next table in the sequence, or null if the end of the sequence is reached.
      Specified by:
        `nextTable` in interface `TableSequence`
      Returns:
        next table, or null if there are no more
      Throws:
        `java.io.IOException` - if there is an error obtaining the table