@Override protected void doStart() { transport.addMessageListener(this); connectionManager.addListener(this); transport.start(); if (transport.boundAddress() != null && logger.isInfoEnabled()) { logger.info("{}", transport.boundAddress()); for (Map.Entry<String, BoundTransportAddress> entry : transport.profileBoundAddresses().entrySet()) { logger.info("profile [{}]: {}", entry.getKey(), entry.getValue()); } } localNode = localNodeFactory.apply(transport.boundAddress()); if (connectToRemoteCluster) { // here we start to connect to the remote clusters remoteClusterService.initializeRemoteClusters(); } }
public TransportAddress[] addressesFromString(String address, int perAddressLimit) throws UnknownHostException { return transport.addressesFromString(address, perAddressLimit); }
public List<String> getLocalAddresses() { return transport.getLocalAddresses(); }
@Override protected void doStart() { adapter.rxMetric.clear(); adapter.txMetric.clear(); transport.transportServiceAdapter(adapter); transport.start(); if (transport.boundAddress() != null && logger.isInfoEnabled()) { logger.info("{}", transport.boundAddress()); for (Map.Entry<String, BoundTransportAddress> entry : transport.profileBoundAddresses().entrySet()) { logger.info("profile [{}]: {}", entry.getKey(), entry.getValue()); } } }
public BoundTransportAddress boundAddress() { return transport.boundAddress(); }
public TransportInfo info() { BoundTransportAddress boundTransportAddress = boundAddress(); if (boundTransportAddress == null) { return null; } return new TransportInfo(boundTransportAddress, transport.profileBoundAddresses()); }
@Override public Connection openConnection(DiscoveryNode node, ConnectionProfile profile) throws IOException { return new FilteredConnection(transport.openConnection(node, profile)) { @Override public void sendRequest(long requestId, String action, TransportRequest request, TransportRequestOptions options) throws IOException, TransportException { DelegateTransport.this.sendRequest(connection, requestId, action, request, options); } }; }
@Override public void connectToNode(DiscoveryNode node, ConnectionProfile connectionProfile, CheckedBiConsumer<Connection, ConnectionProfile, IOException> connectionValidator) throws ConnectTransportException { if (original.nodeConnected(node)) { // connecting to an already connected node is a no-op return; } TimeValue delay = getDelay(); if (delay.millis() <= 0) { original.connectToNode(node, connectionProfile, connectionValidator); return; } // TODO: Replace with proper setting TimeValue connectingTimeout = TcpTransport.TCP_CONNECT_TIMEOUT.getDefault(Settings.EMPTY); try { if (delay.millis() < connectingTimeout.millis()) { Thread.sleep(delay.millis()); original.connectToNode(node, connectionProfile, connectionValidator); } else { Thread.sleep(connectingTimeout.millis()); throw new ConnectTransportException(node, "UNRESPONSIVE: simulated"); } } catch (InterruptedException e) { throw new ConnectTransportException(node, "UNRESPONSIVE: simulated"); } }
@Override protected void doClose() throws IOException { transport.close(); }
public TransportStats stats() { return transport.getStats(); }
@Override public void start() { transport.start(); }
@Override public void connectToNode(DiscoveryNode node, ConnectionProfile connectionProfile, CheckedBiConsumer<Connection, ConnectionProfile, IOException> connectionValidator) throws ConnectTransportException { transport.connectToNode(node, connectionProfile, connectionValidator); }
@Override public void disconnectFromNode(DiscoveryNode node) { transport.disconnectFromNode(node); }
@Override protected void doStart() { adapter.rxMetric.clear(); adapter.txMetric.clear(); transport.transportServiceAdapter(adapter); transport.start(); if (transport.boundAddress() != null && logger.isInfoEnabled()) { logger.info("{}", transport.boundAddress()); for (Map.Entry<String, BoundTransportAddress> entry : transport.profileBoundAddresses().entrySet()) { logger.info("profile [{}]: {}", entry.getKey(), entry.getValue()); } } localNode = localNodeFactory.apply(transport.boundAddress()); registerRequestHandler( HANDSHAKE_ACTION_NAME, () -> HandshakeRequest.INSTANCE, ThreadPool.Names.SAME, false, false, (request, channel) -> channel.sendResponse( new HandshakeResponse(localNode, clusterName, localNode.getVersion()))); if (connectToRemoteCluster) { // here we start to connect to the remote clusters remoteClusterService.initializeRemoteClusters(); } }
@Override public BoundTransportAddress boundAddress() { return transport.boundAddress(); }
@Override public Map<String, BoundTransportAddress> profileBoundAddresses() { return transport.profileBoundAddresses(); }
private Transport.Connection internalOpenConnection(DiscoveryNode node, ConnectionProfile connectionProfile) { PlainActionFuture<Transport.Connection> future = PlainActionFuture.newFuture(); Releasable pendingConnection = transport.openConnection(node, connectionProfile, future); Transport.Connection connection; try { connection = future.actionGet(); } catch (IllegalStateException e) { // If the future was interrupted we must cancel the pending connection to avoid channels leaking if (e.getCause() instanceof InterruptedException) { pendingConnection.close(); } throw e; } try { connectionListener.onConnectionOpened(connection); } finally { connection.addCloseListener(ActionListener.wrap(() -> connectionListener.onConnectionClosed(connection))); } if (connection.isClosed()) { throw new ConnectTransportException(node, "a channel closed while connecting"); } return connection; }
@Override public void close() { transport.close(); }
@Override public TransportStats getStats() { return transport.getStats(); }
@Override protected void doStart() { transport.addConnectionListener(this); transport.start(); if (transport.boundAddress() != null && logger.isInfoEnabled()) { logger.info("{}", transport.boundAddress()); for (Map.Entry<String, BoundTransportAddress> entry : transport.profileBoundAddresses().entrySet()) { logger.info("profile [{}]: {}", entry.getKey(), entry.getValue()); } } localNode = localNodeFactory.apply(transport.boundAddress()); if (connectToRemoteCluster) { // here we start to connect to the remote clusters remoteClusterService.initializeRemoteClusters(); } }