diff --git a/src/main/java/org/redisson/client/RedisClient.java b/src/main/java/org/redisson/client/RedisClient.java index a96d43899..0eb87a353 100644 --- a/src/main/java/org/redisson/client/RedisClient.java +++ b/src/main/java/org/redisson/client/RedisClient.java @@ -1,5 +1,5 @@ /** - * Copyright 2016 Nikita Koksharov + * Copyright 2014 Nikita Koksharov, Nickolay Borbit * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,13 +56,26 @@ public class RedisClient { private boolean hasOwnGroup; public RedisClient(String address) { - this(URIBuilder.create(address).getHost(), URIBuilder.create(address).getPort()); + this(URIBuilder.create(address)); + } + + public RedisClient(URI address) { + this(new NioEventLoopGroup(), address); + hasOwnGroup = true; + } + + public RedisClient(EventLoopGroup group, URI address) { + this(group, address.getHost(), address.getPort()); } public RedisClient(String host, int port) { this(new NioEventLoopGroup(), NioSocketChannel.class, host, port, 60 * 1000); hasOwnGroup = true; } + + public RedisClient(EventLoopGroup group, String host, int port) { + this(group, NioSocketChannel.class, host, port, 60 * 1000); + } public RedisClient(EventLoopGroup group, Class socketChannelClass, String host, int port, int timeout) { addr = new InetSocketAddress(host, port); @@ -156,6 +169,9 @@ public class RedisClient { } public ChannelGroupFuture shutdownAsync() { + for (Channel channel : channels) { + RedisConnection.getFrom(channel).setClosed(true); + } return channels.close(); }