diff --git a/src/main/java/redis/clients/jedis/Pipeline.java b/src/main/java/redis/clients/jedis/Pipeline.java index 36fab65602..af6d39ee2d 100644 --- a/src/main/java/redis/clients/jedis/Pipeline.java +++ b/src/main/java/redis/clients/jedis/Pipeline.java @@ -10,6 +10,7 @@ import redis.clients.jedis.exceptions.JedisDataException; import redis.clients.jedis.graph.GraphCommandObjects; import redis.clients.jedis.params.*; +import redis.clients.jedis.util.IOUtils; import redis.clients.jedis.util.KeyValue; public class Pipeline extends PipelineBase implements DatabasePipelineCommands, Closeable { @@ -46,10 +47,12 @@ public final Response appendCommand(CommandObject commandObject) { @Override public void close() { - sync(); - - if (closeConnection) { - connection.close(); + try { + sync(); + } finally { + if (closeConnection) { + IOUtils.closeQuietly(connection); + } } }