this.connector.addSession(new ClosedMemcachedTCPSession(inetSocketAddressWrapper));
public Future<Boolean> connect(InetSocketAddressWrapper addressWrapper) { if (addressWrapper == null) { throw new NullPointerException("Null Address"); } // Remove addr from removed set this.removedAddrSet.remove(addressWrapper.getInetSocketAddress()); SocketChannel socketChannel = null; ConnectFuture future = new ConnectFuture(addressWrapper); try { socketChannel = SocketChannel.open(); this.configureSocketChannel(socketChannel); if (!socketChannel.connect(addressWrapper.getInetSocketAddress())) { this.selectorManager.registerChannel(socketChannel, SelectionKey.OP_CONNECT, future); } else { this.addSession(this.createSession(socketChannel, addressWrapper)); future.setResult(true); } } catch (Exception e) { if (socketChannel != null) { try { socketChannel.close(); } catch (IOException e1) { //propagate original exception } } future.failure(e); } return future; }
} else { key.attach(null); this.addSession(this.createSession((SocketChannel) key.channel(), future.getInetSocketAddressWrapper())); future.setResult(Boolean.TRUE);
this.connector.addSession(new ClosedMemcachedTCPSession(inetSocketAddressWrapper));
public Future<Boolean> connect(InetSocketAddressWrapper addressWrapper) { if (addressWrapper == null) { throw new NullPointerException("Null Address"); } // Remove addr from removed set this.removedAddrSet.remove(addressWrapper.getInetSocketAddress()); SocketChannel socketChannel = null; ConnectFuture future = new ConnectFuture(addressWrapper); try { socketChannel = SocketChannel.open(); this.configureSocketChannel(socketChannel); if (!socketChannel.connect(addressWrapper.getInetSocketAddress())) { this.selectorManager.registerChannel(socketChannel, SelectionKey.OP_CONNECT, future); } else { this.addSession(this.createSession(socketChannel, addressWrapper)); future.setResult(true); } } catch (Exception e) { if (socketChannel != null) { try { socketChannel.close(); } catch (IOException e1) { //propagate original exception } } future.failure(e); } return future; }
} else { key.attach(null); this.addSession(this.createSession((SocketChannel) key.channel(), future.getInetSocketAddressWrapper())); future.setResult(Boolean.TRUE);