public class AutoCloseableManager extends Object implements Managed
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);
Constructor and Description |
---|
AutoCloseableManager(AutoCloseable autoCloseable) |
Modifier and Type | Method and Description |
---|---|
void |
start()
The start operation does nothing (i.e.
|
void |
stop()
Calls
AutoCloseable.close() on the closable provided in
AutoCloseableManager(AutoCloseable) . |
public AutoCloseableManager(AutoCloseable autoCloseable)
autoCloseable
- instance to close when the HTTP server stops.public void start() throws Exception
public void stop() throws Exception
AutoCloseable.close()
on the closable provided in
AutoCloseableManager(AutoCloseable)
.stop
in interface Managed
Exception
- propagates AutoCloseable.close()
exceptionCopyright © 2011. All rights reserved.