/** * Send a request to the given address * * @return the client request to poll for a response, or null if the request could not be written * at the moment */ public ActorFuture<ClientResponse> sendRequest( final int nodeId, final BufferWriter writer, final Duration timeout) { return clientTransport.getOutput().sendRequest(nodeId, writer, timeout); }
/** * Send a request to the given address * * @return the client request to poll for a response, or null if the request could not be written * at the moment */ public ActorFuture<ClientResponse> sendRequest( final int nodeId, final BufferWriter writer, final Duration timeout) { return clientTransport.getOutput().sendRequest(nodeId, writer, timeout); }
private ActorFuture<ClientResponse> sendEventTo(GossipEvent event, int nodeId, Duration timeout) { return clientTransport.getOutput().sendRequest(nodeId, event, timeout); }
private ActorFuture<ClientResponse> sendEventTo(GossipEvent event, int nodeId, Duration timeout) { return clientTransport.getOutput().sendRequest(nodeId, event, timeout); }
private void refreshTopology() { final BrokerClusterStateImpl brokerClusterState = topology.get(); final int endpoint; if (brokerClusterState != null) { endpoint = brokerClusterState.getRandomBroker(); } else { // never fetched topology before so use initial contact point node endpoint = ClientTransport.UNKNOWN_NODE_ID; } final ActorFuture<ClientResponse> responseFuture = output.sendRequest(endpoint, topologyRequest, Duration.ofSeconds(1)); refreshAttempt++; lastRefreshTime = ActorClock.currentTimeMillis(); actor.runOnCompletion(responseFuture, this::handleResponse); actor.runDelayed(MAX_REFRESH_INTERVAL_MILLIS, scheduleIdleRefresh()); }
/** Only use if node id is not known, i.e. on initial join with contact points */ public ActorFuture<ClientResponse> sendPing(SocketAddress socketAddress, Duration timeout) { gossipFailureDetectionEvent .reset() .eventType(GossipEventType.PING) .senderId(membershipList.self().getId()); clientTransport.registerEndpoint(UNKNOWN_NODE_ID, socketAddress); return clientTransport .getOutput() .sendRequest(UNKNOWN_NODE_ID, gossipFailureDetectionEvent, timeout); } }
/** Only use if node id is not known, i.e. on initial join with contact points */ public ActorFuture<ClientResponse> sendPing(SocketAddress socketAddress, Duration timeout) { gossipFailureDetectionEvent .reset() .eventType(GossipEventType.PING) .senderId(membershipList.self().getId()); clientTransport.registerEndpoint(UNKNOWN_NODE_ID, socketAddress); return clientTransport .getOutput() .sendRequest(UNKNOWN_NODE_ID, gossipFailureDetectionEvent, timeout); } }