Package uk.ac.starlink.table
Class QueueTableSequence
java.lang.Object
uk.ac.starlink.table.QueueTableSequence
- All Implemented Interfaces:
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
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a load error to the queue.void
Adds a table to the queue.void
Indicates that no more load success or failure indications will be added by the queue writer.Returns the next table in the sequence, or null if the end of the sequence is reached.
-
Constructor Details
-
QueueTableSequence
public QueueTableSequence()Constructor.
-
-
Method Details
-
addTable
Adds a table to the queue. This will appear in the TableSequence as a table loadSuccess.- Parameters:
table
- successfully loaded table
-
addError
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
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:
IOException
- if there is an error obtaining the table
-