Skip to content

Commit

Permalink
change isinterrupted by isalive
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Nov 19, 2024
1 parent 96e4ce9 commit 3c638eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void call(Thread parentThread) throws IOException, InterruptedException {
}

position += transferred;
if (parentThread.isInterrupted()) {
if (!parentThread.isAlive()) {
// Close resources if needed and exit
closeResources();
throw new InterruptedException("File download was interrupted.");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/bioimage/modelrunner/utils/ZipUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public static long getUncompressedSize(File zipFile, Thread parentThread) throws
try (ZipFile zip = new ZipFile(zipFile)) {
Enumeration<? extends ZipEntry> entries = zip.entries();

while (entries.hasMoreElements() && !parentThread.isInterrupted()) {
while (entries.hasMoreElements() && parentThread.isAlive()) {
ZipEntry entry = entries.nextElement();

// Skip directories
Expand All @@ -171,7 +171,7 @@ private static long calculateEntrySize(ZipFile zip, ZipEntry entry, Thread paren

try (InputStream is = zip.getInputStream(entry)) {
int read;
while ((read = is.read(buffer)) != -1 && !parentThread.isInterrupted()) {
while ((read = is.read(buffer)) != -1 && parentThread.isAlive()) {
size += read;
}
}
Expand Down

0 comments on commit 3c638eb

Please sign in to comment.