Class AutoCloseableManager

java.lang.Object
io.dropwizard.lifecycle.AutoCloseableManager
All Implemented Interfaces:
Managed

public class AutoCloseableManager extends Object implements Managed
An implementation of the Managed Interface for AutoCloseable instances. Adding an AutoCloseableManager instance to the application's environment ties that object’s lifecycle to that of the application’s HTTP server. After the server has stopped (and after its graceful shutdown period) the stop() method is called, which will trigger the call to AutoCloseable.close()

Usage :

 
 AutoCloseable client = ...;
 AutoCloseableManager clientManager = new AutoCloseableManager(client);
 environment.lifecycle().manage(clientManager);