uk.ac.starlink.table
Class QueueTableSequence

java.lang.Object
  extended by uk.ac.starlink.table.QueueTableSequence
All Implemented Interfaces:
TableSequence

public class QueueTableSequence
extends 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
QueueTableSequence()
          Constructor.
 
Method Summary
 void addError(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(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 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:
IOException - if there is an error obtaining the table

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.