Package noaa.coastwatch.io.tile
Class TileDeliveryOperation
java.lang.Object
java.util.Observable
noaa.coastwatch.io.tile.TileDeliveryOperation
A
TileDeliveryOperation
represents an asynchronous process for
delivering tiles of data from a TileSource
to a number of
Observer
objects. Each observer receives a TilingScheme.Tile
object after each tile has been read from the source. If an exception is
encountered while delivering tiles, the observer object will be null, and
the getLastReadException()
method will return the latest exception
received.- Since:
- 3.3.1
- Author:
- Peter Hollemans
-
Constructor Summary
ConstructorDescriptionTileDeliveryOperation
(TileSource source, Iterable<TilingScheme.TilePosition> positions) Creates a new delivery operation that reads tiles from a source. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancels this operation.Gets the last exception received from reading tiles from the source.Gets the source for this delivery operation.boolean
Checks if this operation is finished.static void
Tests this class.void
start()
Starts the operation.void
Waits for the operation to finish.Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
Constructor Details
-
TileDeliveryOperation
Creates a new delivery operation that reads tiles from a source. The operation is created but not started.- Parameters:
source
- the source to read tile data from.positions
- the positions to read.- See Also:
-
-
Method Details
-
getSource
Gets the source for this delivery operation.- Returns:
- the tile source.
-
getLastReadException
Gets the last exception received from reading tiles from the source.- Returns:
- the last exception, or null if no exception has occurred.
-
start
public void start()Starts the operation. Tiles will begin to be read in a parallel thread, and observers notified when tiles are ready. This method returns immediately, and may only be called once.- See Also:
-
waitUntilFinished()
cancel()
isFinished
-
waitUntilFinished
Waits for the operation to finish. This method should only be called to synchronize the operation, and will exit when the delivery operation is complete. If no operation is in progress, the method exits immediately.- Throws:
InterruptedException
- if the current thread is interrupted waiting for the operation to finish.
-
cancel
public void cancel()Cancels this operation. This method may only be called if thestart()
method has been called. -
isFinished
public boolean isFinished()Checks if this operation is finished. -
main
Tests this class.- Parameters:
argv
- the array of command line parameters.- Throws:
Exception
-