In Proxyee-down, managing multiple download tasks efficiently relies on a well-structured queue system that supports prioritization and concurrency control. This architecture ensures optimal use of bandwidth and system resources while maintaining user control over active downloads.
Task Queue Fundamentals
The application maintains a central task queue rendered via the Tasks.vue component in the frontend. This interface lists all pending, active, paused, or completed downloads and enables user actions such as starting, pausing, resuming, or removing tasks.
Task Creation and Priority Assignment
New download tasks are initiated through an HTTP API endpoint defined in ApiController.java:
@RequestMapping("createTask")
public FullHttpResponse createTask(Channel channel, FullHttpRequest request) throws Exception {
Map<String, String> params = getQueryParams(request);
String redirectUrl = "/#/tasks?request=" + params.get("request") +
"&response=" + params.get("response") +
"&config=" + params.get("config") +
"&data=" + params.get("data");
DownApplication.INSTANCE.loadUri(redirectUrl, false);
FullHttpResponse resp = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
resp.headers().set("Access-Control-Allow-Origin", "*");
return resp;
}
Although explicit priority levels (e.g., HIGH, MEDIUM, LOW) aren't hardcoded as enums, task priority is implicitly managed through metadata in the TaskForm object, which carries URL, destination path, and scheduling hints used during queue inseriton.
Concurrency Control Mechanism
Concurrent downloads are orchestrated by the HttpDownBootstrap class. The utility method fastDownload in AppUtil.java spawns download instances with callbacks:
public static HttpDownBootstrap fastDownload(String url, File dest, HttpDownCallback cb) throws IOException {
HttpDownBootstrap boot = HttpDownBootstrap.start(url, dest);
boot.setCallback(cb);
return boot;
}
The maximum number of simultaneous downloads is configurable via application settings. The default download directory is initialized in DownApplication.java:
serverConfigInfo.setFilePath(System.getProperty("user.home") + File.separator + "Downloads");
This limit prevents resource exhaustion and stabilizes throughput under varying network conditions.
Real-Time Task Monitoring
Progress metrics—such as total size, downloaded bytes, speed, and status—are exposed through the getUpdateProgress endpoint in NativeController.java:
@RequestMapping("getUpdateProgress")
public FullHttpResponse getUpdateProgress(Channel ch, FullHttpRequest req) throws Exception {
Map<String, Object> info = new HashMap<>();
if (updateBootstrap != null) {
TaskInfo ti = updateBootstrap.getTaskInfo();
HttpResponse res = updateBootstrap.getResponse();
info.put("status", ti.getStatus());
info.put("totalSize", res.getTotalSize());
info.put("downSize", ti.getDownSize());
info.put("speed", ti.getSpeed());
} else {
info.put("status", 0);
}
return HttpHandlerUtil.buildJson(info);
}
This data powers live updates in the UI, enabling responsive user interaction.
User-Driven Queue Manipulation
Queue reordering and manual priority adjustments are handled in the Resolve.vue frontend component, where drag-and-drop or explicit priority controls modify task execution order with out restarting the scheduler.
Optimization Guidelines
- Prioritize critical files: Assign higher execution precedence to essential documents over large media files to preserve bandwidth for urgent tasks.
- Tune concurrency limits: Adjust the maximum concurrent downloads in
Setting.vuebased on available bandwidth—higher values suit fiber connections, while limited or unstable networks benefit from lower concurrency. - Monitor task health: Use real-time progress data and logs to identify stalled or failed downloads, then refine priority rules or retry strategies accordingly.