// Update tile status to "computed".
tileStatus =
new Integer(TileRequest.TILE_STATUS_COMPUTED);
request.tileStatus.put(p, tileStatus);
TileComputationListener listener =
(TileComputationListener)iter.next();
listener.tileComputed(this,
reqs,
owner,
p.x, p.y,
tiles[j]);
}
} catch (Exception e) {
exception = e;
// Abort the remaining tiles in the job.
break;
}
/* XXX
try {
List reqList;
synchronized(tileRequests) {
Long tileID = tileKey(owner, p.x, p.y);
reqList = (List)tileRequests.remove(tileID);
tileJobs.remove(tileID);
}
if(reqList != null) {
tiles[j] = owner.getTile(p.x, p.y);
TileRequest[] reqs =
(TileRequest[])reqList.toArray(new TileRequest[0]);
Set listeners = getListeners(reqList);
if(listeners != null) {
Iterator iter = listeners.iterator();
while(iter.hasNext()) {
TileComputationListener listener =
(TileComputationListener)iter.next();
listener.tileComputed(this,
reqs,
owner,
p.x, p.y,
tiles[j]);
}
}
}
} catch (Exception e) {
exception = e;
// Abort the remaining tiles in the job.
break;
}
*/
}
}
// If an exception occured, notify listeners that all remaining
// tiles in the job have failed.
if(exception != null && request != null && request.listeners != null) {
int lastOffset = j;
int numFailed = numTiles - (lastOffset - offset);
// Mark all tiles starting with the one which generated the
// Exception as "failed".
for(int i = 0, k = lastOffset; i < numFailed; i++) {
Integer tileStatus =
new Integer(TileRequest.TILE_STATUS_FAILED);
request.tileStatus.put(tileIndices[k++], tileStatus);
}
// Notify listeners.
Request[] reqs = new Request[] {request};
for(int i = 0, k = lastOffset; i < numFailed; i++) {
Point p = tileIndices[k++];
Iterator iter = request.listeners.iterator();
while(iter.hasNext()) {
TileComputationListener listener =
(TileComputationListener)iter.next();
listener.tileComputationFailure(this, reqs,
owner, p.x, p.y,
exception);
}
}
}