/** * Create a new client that connects to the supplied host and port. Connection * attempts and non-blocking commands will {@link #setDefaultTimeout timeout} * after 60 seconds. * * @param host Server hostname. * @param port Server port. */ public RedisClient(String host, int port) { ExecutorService connectors = Executors.newFixedThreadPool(1); ExecutorService workers = Executors.newCachedThreadPool(); ClientSocketChannelFactory factory = new NioClientSocketChannelFactory(connectors, workers); InetSocketAddress addr = new InetSocketAddress(host, port); bootstrap = new ClientBootstrap(factory); bootstrap.setOption("remoteAddress", addr); setDefaultTimeout(60, TimeUnit.SECONDS); channels = new DefaultChannelGroup(); timer = new HashedWheelTimer(); }
/** * Create a new client that connects to the supplied host and port. Connection * attempts and non-blocking commands will {@link #setDefaultTimeout timeout} * after 60 seconds. * * @param host Server hostname. * @param port Server port. */ public RedisClient(String host, int port) { ExecutorService connectors = Executors.newFixedThreadPool(1); ExecutorService workers = Executors.newCachedThreadPool(); ClientSocketChannelFactory factory = new NioClientSocketChannelFactory(connectors, workers); InetSocketAddress addr = new InetSocketAddress(host, port); bootstrap = new ClientBootstrap(factory); bootstrap.setOption("remoteAddress", addr); setDefaultTimeout(60, TimeUnit.SECONDS); channels = new DefaultChannelGroup(); timer = new HashedWheelTimer(); }