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

Add timeout to shutdown #2052

Merged
merged 1 commit into from
Oct 31, 2024
Merged
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 @@ -18,6 +18,7 @@
import io.lighty.core.controller.impl.config.ControllerConfiguration;
import io.lighty.core.controller.impl.util.ControllerConfigUtils;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.AfterClass;
Expand Down Expand Up @@ -50,7 +51,7 @@ public void init() throws ExecutionException, InterruptedException, Configuratio
public void shutdown() {
try {
if (lightyController != null) {
lightyController.shutdown().get();
lightyController.shutdown(60, TimeUnit.SECONDS);
}
} catch (Exception e) {
LOG.error("Shutdown of LightyController failed", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.lighty.core.controller.impl.util.ControllerConfigUtils;
import java.util.Collections;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.Test;
import org.opendaylight.controller.cluster.ActorSystemProvider;
import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
Expand Down Expand Up @@ -198,7 +199,7 @@ public LightyController initLightyController() throws LightyLaunchException, Int
public void shutdownLightyController(LightyController lightyController) throws LightyLaunchException {
try {
LOG.info("Shutting down LightyController ...");
lightyController.shutdown().get();
lightyController.shutdown(60, TimeUnit.SECONDS);
} catch (Exception e) {
throw new LightyLaunchException("Could not shutdown LightyController", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import io.lighty.server.LightyServerBuilder;
import java.net.InetSocketAddress;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.opendaylight.aaa.api.CredentialAuth;
Expand Down Expand Up @@ -81,11 +81,11 @@ public void init() {
}

@AfterMethod
public void tearDown() throws ExecutionException, InterruptedException {
public void tearDown() {
if (aaaLighty != null) {
// Stop the object and ensure that stopping was successful
assertTrue(aaaLighty.stopProcedure());
assertTrue(aaaLighty.shutdown().get());
assertTrue(aaaLighty.shutdown(60, TimeUnit.SECONDS));
}
}

Expand Down
Loading