private void processAckResponse(ClientResponse response) { final DirectBuffer responseBuffer = response.getResponseBuffer(); ackResponse.wrap(responseBuffer, 0, responseBuffer.capacity()); }
() -> sendSyncRequest(ackResponse.getSenderId(), response.getRemoteAddress())); } else { LOG.info(
() -> sendSyncRequest(ackResponse.getSenderId(), response.getRemoteAddress())); } else { LOG.info(
private void processAckResponse(ClientResponse response) { final DirectBuffer responseBuffer = response.getResponseBuffer(); ackResponse.wrap(responseBuffer, 0, responseBuffer.capacity()); }
private void processAckResponse(ClientResponse response) { final DirectBuffer responseBuffer = response.getResponseBuffer(); ackResponse.wrap(responseBuffer, 0, responseBuffer.capacity()); }
private void processAckResponse(ClientResponse response) { final DirectBuffer responseBuffer = response.getResponseBuffer(); ackResponse.wrap(responseBuffer, 0, responseBuffer.capacity()); }
public ControlMessageResponse await() { final ClientResponse response = responseFuture.join(); final DirectBuffer responseBuffer = response.getResponseBuffer(); final ControlMessageResponse result = new ControlMessageResponse(msgPackHelper); result.wrap(responseBuffer, 0, responseBuffer.capacity()); return result; }
public ErrorResponse awaitError() { final ClientResponse response = responseFuture.join(); final DirectBuffer responseBuffer = response.getResponseBuffer(); final ErrorResponse result = new ErrorResponse(msgPackHelper); result.wrap(responseBuffer, 0, responseBuffer.capacity()); return result; }
public ErrorResponse awaitError() { final ClientResponse response = responseFuture.join(); final DirectBuffer responseBuffer = response.getResponseBuffer(); final ErrorResponse result = new ErrorResponse(msgPackHelper); result.wrap(responseBuffer, 0, responseBuffer.capacity()); return result; }
public ExecuteCommandResponse await() { final ClientResponse response = responseFuture.join(); final DirectBuffer responseBuffer = response.getResponseBuffer(); final ExecuteCommandResponse result = new ExecuteCommandResponse(msgPackHelper); result.wrap(responseBuffer, 0, responseBuffer.capacity()); return result; }
public ErrorResponse awaitError() { final ClientResponse response = responseFuture.join(); final DirectBuffer responseBuffer = response.getResponseBuffer(); final ErrorResponse errorResponse = new ErrorResponse(msgPackHelper); errorResponse.wrap(responseBuffer, 0, responseBuffer.capacity()); return errorResponse; }
public ControlMessageResponse await() { final ClientResponse response = responseFuture.join(); final DirectBuffer responseBuffer = response.getResponseBuffer(); final ControlMessageResponse result = new ControlMessageResponse(msgPackHelper); result.wrap(responseBuffer, 0, responseBuffer.capacity()); return result; }
public ExecuteCommandResponse await() { final ClientResponse response = responseFuture.join(); final DirectBuffer responseBuffer = response.getResponseBuffer(); final ExecuteCommandResponse result = new ExecuteCommandResponse(msgPackHelper); result.wrap(responseBuffer, 0, responseBuffer.capacity()); return result; }
public ErrorResponse awaitError() { final ClientResponse response = responseFuture.join(); final DirectBuffer responseBuffer = response.getResponseBuffer(); final ErrorResponse errorResponse = new ErrorResponse(msgPackHelper); errorResponse.wrap(responseBuffer, 0, responseBuffer.capacity()); return errorResponse; }
private void handlePushResponse(final ClientResponse response) { pushDeploymentResponse.wrap(response.getResponseBuffer()); final long deploymentKey = pushDeploymentResponse.deploymentKey(); final PendingDeploymentDistribution pendingDeploymentDistribution = deploymentsState.getPendingDeployment(deploymentKey); final long remainingPartitions = pendingDeploymentDistribution.decrementCount(); if (remainingPartitions == 0) { LOG.debug("Deployment pushed to all partitions successfully."); pendingDeploymentFutures.remove(deploymentKey).complete(null); } else { LOG.trace( "Deployment was pushed to partition {} successfully.", pushDeploymentResponse.partitionId()); } } }
private void handlePushResponse(final ClientResponse response) { pushDeploymentResponse.wrap(response.getResponseBuffer()); final long deploymentKey = pushDeploymentResponse.deploymentKey(); final PendingDeploymentDistribution pendingDeploymentDistribution = deploymentsState.getPendingDeployment(deploymentKey); final long remainingPartitions = pendingDeploymentDistribution.decrementCount(); if (remainingPartitions == 0) { LOG.debug("Deployment pushed to all partitions successfully."); pendingDeploymentFutures.remove(deploymentKey).complete(null); } else { LOG.trace( "Deployment was pushed to partition {} successfully.", pushDeploymentResponse.partitionId()); } } }
private void sendSyncRequest(final int nodeId, final RemoteAddress remoteAddress) { LOG.trace("Send SYNC request to node '{}' with address '{}'", nodeId, remoteAddress); final ActorFuture<ClientResponse> requestFuture = gossipEventSender.sendSyncRequest( nodeId, remoteAddress, configuration.getSyncTimeoutDuration()); actor.runOnCompletion( requestFuture, (request, failure) -> { if (failure == null) { LOG.debug("Received SYNC response."); // process response final DirectBuffer response = request.getResponseBuffer(); syncResponse.wrap(response, 0, response.capacity()); isJoined = true; joinFuture.complete(null); joinFuture = null; LOG.debug("Joined cluster successfully"); } else { LOG.debug( "Failed to receive SYNC response from node '{}'. Try again in {}", nodeId, configuration.getJoinInterval()); actor.runDelayed(configuration.getJoinIntervalDuration(), this::sendJoinEvent); } }); }
private void sendSyncRequest(final int nodeId, final RemoteAddress remoteAddress) { LOG.trace("Send SYNC request to node '{}' with address '{}'", nodeId, remoteAddress); final ActorFuture<ClientResponse> requestFuture = gossipEventSender.sendSyncRequest( nodeId, remoteAddress, configuration.getSyncTimeoutDuration()); actor.runOnCompletion( requestFuture, (request, failure) -> { if (failure == null) { LOG.debug("Received SYNC response."); // process response final DirectBuffer response = request.getResponseBuffer(); syncResponse.wrap(response, 0, response.capacity()); isJoined = true; joinFuture.complete(null); joinFuture = null; LOG.debug("Joined cluster successfully"); } else { LOG.debug( "Failed to receive SYNC response from node '{}'. Try again in {}", nodeId, configuration.getJoinInterval()); actor.runDelayed(configuration.getJoinIntervalDuration(), this::sendJoinEvent); } }); }
public BrokerResponse<T> getResponse(ClientResponse clientResponse) { final DirectBuffer responseBuffer = clientResponse.getResponseBuffer(); try { if (isValidResponse(responseBuffer)) { wrapResponse(responseBuffer); return readResponse(); } else if (isErrorResponse(responseBuffer)) { wrapErrorResponse(responseBuffer); final BrokerError error = new BrokerError(errorResponse); return new BrokerErrorResponse<>(error); } else { throw new UnsupportedBrokerResponseException( headerDecoder.schemaId(), headerDecoder.templateId(), schemaId, templateId); } } catch (Exception e) { // Log response buffer for debugging purpose Loggers.GATEWAY_LOGGER.error( "Failed to read response: {}{}{}", e.getMessage(), System.lineSeparator(), BufferUtil.bufferAsHexString(responseBuffer)); throw e; } }
pendingRequests--; if (throwable == null) { final DirectBuffer responseBuffer = clientRequest.getResponseBuffer();