MINOR: Timeout waitForBlock in connect BlockingConnectorTest (#11595)

Reviewers: Mickael Maison <mickael.maison@gmail.com>, Chris Egerton <fearthecellos@gmail.com>
This commit is contained in:
Lucas Bradstreet 2021-12-15 06:25:16 -08:00 committed by GitHub
parent 065fba9619
commit b4602e88ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -54,6 +54,7 @@ import java.util.Objects;
import java.util.Properties;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@ -351,7 +352,7 @@ public class BlockingConnectorTest {
);
}
public static void waitForBlock() throws InterruptedException {
public static void waitForBlock() throws InterruptedException, TimeoutException {
synchronized (Block.class) {
if (blockLatch == null) {
throw new IllegalArgumentException("No connector has been created yet");
@ -359,7 +360,9 @@ public class BlockingConnectorTest {
}
log.debug("Waiting for connector to block");
blockLatch.await();
if (!blockLatch.await(60, TimeUnit.SECONDS)) {
throw new TimeoutException("Timed out waiting for connector to block.");
}
log.debug("Connector should now be blocked");
}