private void assertNoDeadlocks() {
        long[] deadlockedThreads = ManagementFactory.getThreadMXBean().findDeadlockedThreads();
        if (deadlockedThreads != null && deadlockedThreads.length > 0) {
            final String threads = Arrays
                .stream(ManagementFactory.getThreadMXBean().getThreadInfo(deadlockedThreads))
                .filter(this::threadFromCurrentTest)
                .map(SynchronizationTest::threadInfoToString)
                .collect(Collectors.joining(""));
            if (!threads.isEmpty()) {
                fail("Found deadlocked threads while classloading\n" + threads);
            }
        }
    }
From the test orchestrating thread, await for the test thread to continue execution
@throws InterruptedException If the current thread is interrupted while waiting
@throws BrokenBarrierException If the test thread is interrupted while waiting
@throws TimeoutException If the barrier is not reached before 1s passes.
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/SynchronizationTest.java