debug DownloadWorker.java
This commit is contained in:
@@ -20,13 +20,15 @@ public class DownloadWorker implements Runnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
chunkStatus.setStartTimeMs(start);
|
chunkStatus.setStartTimeMs(System.currentTimeMillis());
|
||||||
|
|
||||||
double downloaded = 0.0;
|
double downloaded = 0.0;
|
||||||
|
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"Chunk (id: " + chunkStatus.getChunkId() + ") has started downloading."
|
"[Worker-" + chunkStatus.getChunkId() +
|
||||||
|
"] Started downloading chunk of size: " +
|
||||||
|
String.format("%.2f", chunkStatus.getChunkSizeMB()) + " MB"
|
||||||
);
|
);
|
||||||
|
|
||||||
while (downloaded < chunkStatus.getChunkSizeMB()) {
|
while (downloaded < chunkStatus.getChunkSizeMB()) {
|
||||||
@@ -38,7 +40,9 @@ public class DownloadWorker implements Runnable {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(randomSleepDelay);
|
Thread.sleep(randomSleepDelay);
|
||||||
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user