Skip to content

Commit

Permalink
Remove interrupted exception, but do nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
alanocallaghan committed Feb 1, 2024
1 parent 8d89f85 commit b3fadec
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import ai.djl.ndarray.NDManager;
import ai.djl.translate.TranslateException;
import org.bytedeco.opencv.global.opencv_core;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import qupath.lib.experimental.pixels.Processor;
import org.bytedeco.opencv.opencv_core.Mat;
import qupath.lib.experimental.pixels.Parameters;
import qupath.lib.plugins.objects.SmoothFeaturesPlugin;
import qupath.lib.regions.Padding;
import qupath.opencv.ops.ImageOp;
import qupath.opencv.tools.OpenCVTools;
Expand All @@ -15,6 +18,7 @@
import java.util.concurrent.BlockingQueue;

class TilePredictionProcessor implements Processor<Mat, Mat, Mat> {
private static final Logger logger = LoggerFactory.getLogger(TilePredictionProcessor.class);

private final BlockingQueue<Predictor<Mat, Mat>> predictors;

Expand All @@ -40,7 +44,7 @@ class TilePredictionProcessor implements Processor<Mat, Mat, Mat> {
}

@Override
public Mat process(Parameters<Mat, Mat> params) throws IOException, InterruptedException {
public Mat process(Parameters<Mat, Mat> params) throws IOException {

var mat = params.getImage();
mat = preprocessing.apply(mat);
Expand Down Expand Up @@ -69,8 +73,13 @@ public Mat process(Parameters<Mat, Mat> params) throws IOException, InterruptedE
// todo: deal with exception
throw new RuntimeException(e);
} finally {
if (predictor != null)
predictors.put(predictor);
if (predictor != null) {
try {
predictors.put(predictor);
} catch (InterruptedException e) {
logger.warn("Tiling interrupted");
}
}
}
}
}

0 comments on commit b3fadec

Please sign in to comment.