From 87455e3163c63f3dcef6dd05f647f5e3d4da245d Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 14 Apr 2022 08:30:59 +0000 Subject: [PATCH] Implements autoclosable interface in abstractredisclient --- src/main/java/io/lettuce/core/AbstractRedisClient.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/lettuce/core/AbstractRedisClient.java b/src/main/java/io/lettuce/core/AbstractRedisClient.java index 953f20e9f5..e12f872810 100644 --- a/src/main/java/io/lettuce/core/AbstractRedisClient.java +++ b/src/main/java/io/lettuce/core/AbstractRedisClient.java @@ -79,7 +79,7 @@ * @since 3.0 * @see ClientResources */ -public abstract class AbstractRedisClient { +public abstract class AbstractRedisClient implements AutoCloseable { private static final InternalLogger logger = InternalLoggerFactory.getInstance(AbstractRedisClient.class); @@ -484,6 +484,11 @@ public void shutdown() { shutdown(0, 2, TimeUnit.SECONDS); } + @Override + public void close() { + shutdown(); + } + /** * Shutdown this client and close all open connections once this method is called. Once all connections are closed, the * associated {@link ClientResources} are shut down/released gracefully considering quiet time and the shutdown timeout. The