Class MongoClientCloser
java.lang.Object
io.micronaut.configuration.mongo.core.MongoClientCloser
- All Implemented Interfaces:
io.micronaut.runtime.graceful.GracefulShutdownCapable
@Singleton
public final class MongoClientCloser
extends Object
implements io.micronaut.runtime.graceful.GracefulShutdownCapable
Tracks Mongo clients and delays bean destruction during Micronaut graceful shutdown.
- Since:
- 6.0.0
- Author:
- graemerocher
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TTrack a client with its configured shutdown delay.voidStop tracking a client once bean destruction completes.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.runtime.graceful.GracefulShutdownCapable
reportActiveTasks
-
Constructor Details
-
MongoClientCloser
public MongoClientCloser()
-
-
Method Details
-
track
Track a client with its configured shutdown delay.- Type Parameters:
T- The mongo client type- Parameters:
client- The clientshutdownDelay- The shutdown delay- Returns:
- The client
-
untrack
Stop tracking a client once bean destruction completes.- Parameters:
client- The client
-
shutdownGracefully
- Specified by:
shutdownGracefullyin interfaceio.micronaut.runtime.graceful.GracefulShutdownCapable
-