mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-08-03 19:36:53 -04:00
update
This commit is contained in:
parent
fbd5c43c98
commit
9f0ccefeff
@ -300,43 +300,6 @@ public abstract class FetchTask<T> extends Task<T> {
|
|||||||
CACHED
|
CACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static final class DownloadState {
|
|
||||||
private final int startPosition;
|
|
||||||
private final int endPosition;
|
|
||||||
private final int currentPosition;
|
|
||||||
private final boolean finished;
|
|
||||||
|
|
||||||
public DownloadState(int startPosition, int endPosition, int currentPosition) {
|
|
||||||
if (currentPosition < startPosition || currentPosition > endPosition) {
|
|
||||||
throw new IllegalArgumentException("Illegal download state: start " + startPosition + ", end " + endPosition + ", cur " + currentPosition);
|
|
||||||
}
|
|
||||||
this.startPosition = startPosition;
|
|
||||||
this.endPosition = endPosition;
|
|
||||||
this.currentPosition = currentPosition;
|
|
||||||
finished = currentPosition == endPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getStartPosition() {
|
|
||||||
return startPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getEndPosition() {
|
|
||||||
return endPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCurrentPosition() {
|
|
||||||
return currentPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFinished() {
|
|
||||||
return finished;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static final class DownloadMission {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int DEFAULT_CONCURRENCY = Math.min(Runtime.getRuntime().availableProcessors() * 4, 64);
|
public static int DEFAULT_CONCURRENCY = Math.min(Runtime.getRuntime().availableProcessors() * 4, 64);
|
||||||
private static int downloadExecutorConcurrency = DEFAULT_CONCURRENCY;
|
private static int downloadExecutorConcurrency = DEFAULT_CONCURRENCY;
|
||||||
private static volatile ThreadPoolExecutor DOWNLOAD_EXECUTOR;
|
private static volatile ThreadPoolExecutor DOWNLOAD_EXECUTOR;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user