|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.geosolutions.jaiext.scheduler.JAIExtTileScheduler
public class JAIExtTileScheduler
This is another implementation of the javax.media.jai.TileScheduler
interface. It provides a mechanism for scheduling tile
calculation. Multi-threading is used whenever possible.
TileScheduler
Field Summary | |
---|---|
static Logger |
LOGGER
Logger associated to the scheduler |
Constructor Summary | |
---|---|
JAIExtTileScheduler()
Constructor. |
|
JAIExtTileScheduler(int parallelism,
int priority,
int prefetchParallelism,
int prefetchPriority)
Constructor. |
Method Summary | |
---|---|
void |
cancelTiles(javax.media.jai.TileRequest request,
Point[] tileIndices)
Issues an advisory cancellation request to the TileScheduler stating that the indicated tiles of the specified image should not be
processed. |
protected void |
finalize()
Queue WorkerThread.TERMINATEs to all workers. |
int |
getParallelism()
Returns the degree of parallelism of the scheduler. |
int |
getPrefetchParallelism()
Identical to getParallelism() but applies only to prefetchTiles() . |
int |
getPrefetchPriority()
Identical to getPriority() but applies only to prefetchTiles() . |
int |
getPriority()
Returns the priority of scheduleTiles() processing. |
void |
prefetchTiles(javax.media.jai.PlanarImage owner,
Point[] tileIndices)
Prefetchs a list of tiles of an image. |
Raster |
scheduleTile(javax.media.jai.OpImage owner,
int tileX,
int tileY)
Schedules a single tile for computation. |
Raster[] |
scheduleTiles(javax.media.jai.OpImage owner,
Point[] tileIndices)
Schedules multiple tiles of an image for computation. |
javax.media.jai.TileRequest |
scheduleTiles(javax.media.jai.PlanarImage target,
Point[] tileIndices,
javax.media.jai.TileComputationListener[] tileListeners)
Schedule a list of tiles for computation. |
void |
setParallelism(int parallelism)
Suggests to the scheduler the degree of parallelism to use in processing invocations of scheduleTiles() . |
void |
setPrefetchParallelism(int parallelism)
Identical to setParallelism() but applies only to prefetchTiles() . |
void |
setPrefetchPriority(int priority)
Identical to setPriority() but applies only to prefetchTiles() . |
void |
setPriority(int priority)
Suggests to the scheduler the priority to assign to processing effected by scheduleTiles() . |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Logger LOGGER
Constructor Detail |
---|
public JAIExtTileScheduler(int parallelism, int priority, int prefetchParallelism, int prefetchPriority)
parallelism
- The number of worker threads to do tile computation. If this number is less than 1, no multi-threading is used.priority
- The priority of worker threads.prefetchParallelism
- The number of threads to do prefetching. If this number is less than 1, no multi-threading is used.prefetchPriority
- The priority of prefetch threads.public JAIExtTileScheduler()
Method Detail |
---|
public Raster scheduleTile(javax.media.jai.OpImage owner, int tileX, int tileY)
scheduleTile
in interface javax.media.jai.TileScheduler
owner
- The image the tiles belong to.tileX
- The tile's X index.tileY
- The tile's Y index.
IllegalArgumentException
- if owner
is null
.public Raster[] scheduleTiles(javax.media.jai.OpImage owner, Point[] tileIndices)
scheduleTiles
in interface javax.media.jai.TileScheduler
owner
- The image the tiles belong to.tileIndices
- An array of tile X and Y indices.
public javax.media.jai.TileRequest scheduleTiles(javax.media.jai.PlanarImage target, Point[] tileIndices, javax.media.jai.TileComputationListener[] tileListeners)
TileScheduler
implementation uses multithreading, it is at the discretion of the implementation which
thread invokes the TileComputationListener
methods.
scheduleTiles
in interface javax.media.jai.TileScheduler
public void cancelTiles(javax.media.jai.TileRequest request, Point[] tileIndices)
TileScheduler
stating that the indicated tiles of the specified image should not be
processed. The handling of this request is at the discretion of the scheduler which may cancel tile processing in progress and remove tiles
from its internal queue, remove tiles from the queue but not terminate current processing, or simply do nothing.
In this implementation of TileScheduler
the second tile cancellation option is implemented, i.e., tiles are removed from the
internal queue but computation already in progress is not terminated. If there is at least one worker thread this method should be
non-blocking. Any tiles allowed to complete computation subsequent to this call are complete and will be treated as if they had not been
cancelled, e.g., with respect to caching, notification of registered listeners, etc. Furthermore, canceling a tile request in no way
invalidates the tile as a candidate for future recomputation.
cancelTiles
in interface javax.media.jai.TileScheduler
public void prefetchTiles(javax.media.jai.PlanarImage owner, Point[] tileIndices)
prefetchTiles
in interface javax.media.jai.TileScheduler
owner
- The image the tiles belong to.tileIndices
- An array of tile X and Y indices.public void setParallelism(int parallelism)
scheduleTiles()
. For example, this might
set the number of threads to spawn. It is legal to implement this method as a no-op.
In this implementation of TileScheduler this method sets the number of worker threads actually used for tile computation. Ideally this number should equal the number of processors actually available on the system. It is the responsibility of the application to set this value as the number of processors is not available via the virtual machine. A parallelism value of zero indicates that all tile computation will be effected in the primary thread. A parallelism value of N indicates that there will be N worker threads in addition to the primary scheduler thread. In JAI the parallelism defaults to a value of 2 unless explicity set by the application.
setParallelism
in interface javax.media.jai.TileScheduler
parallelism
- The suggested degree of parallelism.
IllegalArgumentException
- if parallelism
is negative.public int getParallelism()
getParallelism
in interface javax.media.jai.TileScheduler
public void setPrefetchParallelism(int parallelism)
setParallelism()
but applies only to prefetchTiles()
.
setPrefetchParallelism
in interface javax.media.jai.TileScheduler
public int getPrefetchParallelism()
getParallelism()
but applies only to prefetchTiles()
.
getPrefetchParallelism
in interface javax.media.jai.TileScheduler
public void setPriority(int priority)
scheduleTiles()
. For example, this might set thread
priority. Values outside of the accepted priority range will be clamped to the nearest extremum. An implementation may clamp the prefetch
priority to less than the scheduling priority. It is legal to implement this method as a no-op.
In this implementation of TileScheduler this method sets the priority of the worker threads used for tile computation. Its initial value is
Thread.NORM_PRIORITY
.
setPriority
in interface javax.media.jai.TileScheduler
priority
- The suggested priority.public int getPriority()
scheduleTiles()
processing.
getPriority
in interface javax.media.jai.TileScheduler
public void setPrefetchPriority(int priority)
setPriority()
but applies only to prefetchTiles()
.
In this implementation of TileScheduler
, this method sets the priority of any threads spawned to prefetch tiles. Its initial value
is Thread.MIN_PRIORITY
.
setPrefetchPriority
in interface javax.media.jai.TileScheduler
public int getPrefetchPriority()
getPriority()
but applies only to prefetchTiles()
.
getPrefetchPriority
in interface javax.media.jai.TileScheduler
protected void finalize() throws Throwable
finalize
in class Object
Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |