Skip to content

Commit

Permalink
Reset tile queue size if max workers is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
melissalinkert committed Oct 16, 2023
1 parent 2cc870e commit a0dafc7
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,9 @@ public void setSplitTIFFs(boolean split) {
description = "Maximum number of workers (default: ${DEFAULT-VALUE})"
)
public void setMaxWorkers(int workers) {
if (workers > 0) {
if (workers > 0 && workers != maxWorkers) {
maxWorkers = workers;
tileQueue = new LimitedQueue<Runnable>(maxWorkers);
}
}

Expand Down Expand Up @@ -495,7 +496,11 @@ public void resetSplitTIFFs() {
/**
*/
public void resetMaxWorkers() {
maxWorkers = Runtime.getRuntime().availableProcessors();
int defaultWorkers = Runtime.getRuntime().availableProcessors();
if (defaultWorkers != maxWorkers) {
maxWorkers = defaultWorkers;
tileQueue = new LimitedQueue<Runnable>(maxWorkers);
}
}

/**
Expand Down

0 comments on commit a0dafc7

Please sign in to comment.