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

Separate blocking shutdown #2048

Merged
merged 1 commit into from
Oct 31, 2024
Merged
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 @@ -193,7 +193,6 @@ public synchronized ListenableFuture<Boolean> shutdown() {
@Override
public final boolean shutdown(final long duration, final TimeUnit unit) {
try {
shutdownLatch.countDown();
final var stopSuccess = shutdown().get(duration, unit);
if (stopSuccess) {
LOG.info("LightyModule {} stopped successfully!", getClass().getSimpleName());
Expand All @@ -209,4 +208,20 @@ public final boolean shutdown(final long duration, final TimeUnit unit) {
}
return false;
}

/**
* Invoke blocking shutdown after blocking start.
*
* <p>
* Release CountDownLatch locking this thread and shutdown.
* @param duration duration to wait for shutdown to complete
* @param unit {@link TimeUnit} of {@code duration}
* @return {@code boolean} indicating shutdown sucess
* @deprecated Use {@code shutdown()} or {@code shutdown(duration, unit)} instead in case you want blocking shutdown.
*/
@Deprecated(forRemoval = true)
public final boolean shutdownBlocking(final long duration, final TimeUnit unit) {
shutdownLatch.countDown();
return shutdown(duration, unit);
}
}
Loading