public static void shutdown(final Thread t, final long joinwait) {
        if (t == null) {
            return;
        }
        while (t.isAlive()) {
            try {
                t.join(joinwait);
            } catch (InterruptedException e) {
                logger.warn(t.getName() + "; joinwait=" + joinwait, e);
            }
        }
    }
Shutdown passed thread using isAlive and join.

@param joinwait Pass 0 if we're to wait forever.
@param t        Thread to shutdown
inlong-tubemq/tubemq-core/src/main/java/org/apache/inlong/tubemq/corebase/utils/ThreadUtils.java