Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed the Auditor test end time. #4081

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
* <p>TODO: eliminate the direct usage of zookeeper here {@link https://github.com/apache/bookkeeper/issues/1332}
*/
public class Auditor implements AutoCloseable {
public static final String AUDITOR_AWAIT_TERMINATION = "auditor.awaitTermination";
private final int awaitTermination = Integer.getInteger(AUDITOR_AWAIT_TERMINATION , 30);
private static final Logger LOG = LoggerFactory.getLogger(Auditor.class);
private final ServerConfiguration conf;
private final BookKeeper bkc;
Expand Down Expand Up @@ -620,7 +622,7 @@ public void shutdown() {
LOG.info("Shutting down auditor");
executor.shutdown();
try {
while (!executor.awaitTermination(30, TimeUnit.SECONDS)) {
while (!executor.awaitTermination(awaitTermination, TimeUnit.SECONDS)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will wait at most 30s before enter the shutdownNow logic, not wait at least 30s.

LOG.warn("Executor not shutting down, interrupting");
executor.shutdownNow();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
* A class runs several bookie servers for testing.
*/
public abstract class BookKeeperClusterTestCase {

static {
System.setProperty(Auditor.AUDITOR_AWAIT_TERMINATION, "1");
}

static final Logger LOG = LoggerFactory.getLogger(BookKeeperClusterTestCase.class);

Expand Down
Loading