java – Effective thread usage under blocking scenario


I have the following scenario.

I am listening file requests and when one arrives, I am starting download task in a new thread. After download task ends, a process task starts but this is important, process task must wait for download task. To do that, I can use dt_thread.join() or just stop using thread and download in blocking way. But in both cases, upcoming file requests get blocked and this turns out to be a performance issue.

I need to handle download tasks in threads but also need to ensure that process tasks start after relevant download task.

What kind of thread logic can I apply?

public void activateListener() {
    fileRequestService.listen((name) -> {
        DownloadTask dt = new DownloadTask(); // DownloadTask implements Runnable
        Thread dt_thread = new Thread(dt);
        dt_thread.start();

        ProcessTask pt = new ProcessTask(); // ProcessTask implements Runnable
        Thread pt_thread = new Thread(pt);
        pt_thread.start();       
    }
}