@Override public void reconnect() throws IOException { Connection connection = null; try { final IoFuture<Connection> futureConnection = NetworkUtil.connect(endpoint, destinationHost, destinationPort, null, connectionCreationOptions, callbackHandler, null); connection = IoFutureHelper.get(futureConnection, connectionTimeout, TimeUnit.MILLISECONDS); logger.debug("Successfully reconnected to connection " + connection); } catch (Exception e) { logger.debug("Failed to re-connect to " + this.destinationHost + ":" + this.destinationPort, e); } if (connection == null) { return; } try { final EJBReceiver ejbReceiver = new RemotingConnectionEJBReceiver(connection, this, channelCreationOptions); RemotingConnectionClusterNodeManager.this.clusterContext.registerEJBReceiver(ejbReceiver); } finally { // if we successfully re-connected then unregister this ReconnectHandler from the EJBClientContext RemotingConnectionClusterNodeManager.this.clusterContext.getEJBClientContext().unregisterReconnectHandler(this); } } }
final InetAddress sourceNetworkAddress = clientMapping.getSourceNetworkAddress(); final int netMask = clientMapping.getSourceNetworkMaskBits(); final boolean match = NetworkUtil.belongsToNetwork(bindAddress, sourceNetworkAddress, (byte) (netMask & 0xff)); if (match) { resolvedClientMapping = clientMapping;
final IoFuture<Connection> futureConnection = NetworkUtil.connect(endpoint, destinationHost, destinationPort, null, connectionCreationOptions, callbackHandler, null); final OptionMap connectionCreationOptions = clusterNodeConfiguration == null ? clusterConfiguration.getConnectionCreationOptions() : clusterNodeConfiguration.getConnectionCreationOptions(); final CallbackHandler callbackHandler = clusterNodeConfiguration == null ? clusterConfiguration.getCallbackHandler() : clusterNodeConfiguration.getCallbackHandler(); final IoFuture<Connection> futureConnection = NetworkUtil.connect(endpoint, destinationHost, destinationPort, null, connectionCreationOptions, callbackHandler, null); final long timeout = clusterNodeConfiguration == null ? clusterConfiguration.getConnectionTimeout() : clusterNodeConfiguration.getConnectionTimeout(); final IoFuture<Connection> futureConnection = NetworkUtil.connect(endpoint, destinationHost, destinationPort, null, connectionCreationOptions, callbackHandler, null);