Skip to content

Commit

Permalink
properly close Infinispan
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Lamy <[email protected]>
  • Loading branch information
olamy committed Oct 2, 2024
1 parent f1ad8c7 commit 4cd311b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,23 @@ private Holder()

String content = baos.toString(StandardCharsets.UTF_8);
manager.administration().getOrCreateCache("___protobuf_metadata", (String)null).put("session.proto", content);

Runtime.getRuntime().addShutdownHook(new Thread(() ->
{
try
{
if(container.isRunning())
{
LOG.info("Stopping Infinispan");
container.stop();
}
}
catch (Throwable x)
{
// ignore any error here
LOG.warn(x.getMessage(), x);
}
}));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ public void startExternalSessionStorage() throws Exception
.withEnv("PASS", "foobar")
.withEnv("MGMT_USER", "admin")
.withEnv("MGMT_PASS", "admin")
.withEnv("CONFIG_PATH", "/user-config/config.yaml")
.withEnv("JAVA_OPTIONS", "-Xms64m -Xmx256m -Djgroups.dns.query=infinispan-dns-ping.myproject.svc.cluster.local")
//.withEnv("CONFIG_PATH", "/user-config/config.yaml")
.waitingFor(Wait.forListeningPorts(11222))
.withExposedPorts(4712, 4713, 8088, 8089, 8443, 9990, 9993, 11211, 11222, 11223, 11224)
.withLogConsumer(new Slf4jLogConsumer(INFINISPAN_LOG))
.withClasspathResourceMapping("/config.yaml", "/user-config/config.yaml", BindMode.READ_ONLY);
.withLogConsumer(new Slf4jLogConsumer(INFINISPAN_LOG));
//.withClasspathResourceMapping("/config.yaml", "/user-config/config.yaml", BindMode.READ_ONLY);
infinispan.start();
host = infinispan.getHost();
port = infinispan.getMappedPort(11222);
Expand Down

0 comments on commit 4cd311b

Please sign in to comment.