Java multithreaded join how to stop the current thread and execute the child process

A process executes b. Join. The source code only solves the problem that b process executes wait,join. The function of b process execution is that b process finishes execution, and then executes the logic of a process
.
public final synchronized void join(long millis)
    throws InterruptedException {
        long base = System.currentTimeMillis();
        long now = 0;

        if (millis < 0) {
            throw new IllegalArgumentException("timeout value is negative");
        }

        if (millis == 0) {
            while (isAlive()) {
                wait(0);
            }
        } else {
            while (isAlive()) {
                long delay = millis - now;
                if (delay <= 0) {
                    break;
                }
                wait(delay);
                now = System.currentTimeMillis() - base;
            }
        }
    }
Feb.28,2021
Menu