Develop #1

Merged
Sadra3st merged 6 commits from develop into main 2026-06-10 07:41:46 +00:00
Showing only changes of commit 5fdcd9349c - Show all commits
+26
View File
@@ -37,12 +37,38 @@ public class Main {
// TODO:
// Students may print helpful debug information here,
// for example which chunk is assigned to which worker thread.
System.out.println(
"new thread " + workerThread.getName() + " created for chunk " + chunk.getChunkId()
);
}
// 4. Create and start monitor thread
ProgressMonitor monitor = new ProgressMonitor(config, chunks);
Thread monitorThread = new Thread(monitor, "Progress-Monitor");
monitorThread.start();
for (Thread thread : workerThreads) {
thread.start();
}
try {
for (Thread thread : workerThreads) {
thread.join();
}
} catch (InterruptedException e) {
System.out.println("Download manager was interrupted. Stopping all workers...");
monitorThread.interrupt();
for (Thread worker : workerThreads) {
worker.interrupt();
}
Thread.currentThread().interrupt();
return;
}
// TODO:
// Start the monitor thread before starting the workers
// so that progress can be displayed while downloading happens.