Skip to content

Commit

Permalink
updating ShutdownManager calls after bootique/bootique#346
Browse files Browse the repository at this point in the history
  • Loading branch information
andrus committed Dec 6, 2023
1 parent ac09df2 commit d33650d
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/main/java/io/bootique/curator/CuratorModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import io.bootique.config.ConfigurationFactory;
import io.bootique.di.Binder;
import io.bootique.di.Provides;
import io.bootique.log.BootLogger;
import io.bootique.shutdown.ShutdownManager;
import org.apache.curator.framework.CuratorFramework;

Expand All @@ -48,20 +47,9 @@ public void configure(Binder binder) {

@Provides
@Singleton
public CuratorFramework createCurator(
ConfigurationFactory configFactory,
BootLogger bootLogger,
ShutdownManager shutdownManager) {

public CuratorFramework createCurator(ConfigurationFactory configFactory, ShutdownManager shutdownManager) {
CuratorFramework client = configFactory.config(CuratorFrameworkFactory.class, CONFIG_PREFIX).createZkClient();

shutdownManager.addShutdownHook(() -> {
bootLogger.trace(() -> "shutting down Curator...");
client.close();
});

client.start();

return client;
return shutdownManager.onShutdown(client);
}
}

0 comments on commit d33650d

Please sign in to comment.