Package 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. ThenextTable
method will block until a result is available.- Since:
- 27 Sep 2010
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description QueueTableSequence()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
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 interfaceTableSequence
- Returns:
- next table, or null if there are no more
- Throws:
java.io.IOException
- if there is an error obtaining the table
-
-