use of org.apache.cassandra.net.NoPayload in project cassandra by apache.
the class Gossiper method markAlive.
private void markAlive(final InetAddressAndPort addr, final EndpointState localState) {
localState.markDead();
Message<NoPayload> echoMessage = Message.out(ECHO_REQ, noPayload);
logger.trace("Sending ECHO_REQ to {}", addr);
RequestCallback echoHandler = msg -> {
// force processing of the echo response onto the gossip stage, as it comes in on the REQUEST_RESPONSE stage
runInGossipStageBlocking(() -> realMarkAlive(addr, localState));
};
MessagingService.instance().sendWithCallback(echoMessage, addr, echoHandler);
GossiperDiagnostics.markedAlive(this, addr, localState);
}
use of org.apache.cassandra.net.NoPayload in project cassandra by apache.
the class HintsTestUtil method sendHintsAndResponses.
static MockMessagingSpy sendHintsAndResponses(TableMetadata metadata, int noOfHints, int noOfResponses) {
// create spy for hint messages, but only create responses for noOfResponses hints
Message<NoPayload> message = Message.internalResponse(HINT_RSP, NoPayload.noPayload);
MockMessagingSpy spy;
if (noOfResponses != -1) {
spy = MockMessagingService.when(verb(HINT_REQ)).respondN(message, noOfResponses);
} else {
spy = MockMessagingService.when(verb(HINT_REQ)).respond(message);
}
// create and write noOfHints using service
UUID hostId = StorageService.instance.getLocalHostUUID();
for (int i = 0; i < noOfHints; i++) {
long now = Clock.Global.currentTimeMillis();
DecoratedKey dkey = dk(String.valueOf(i));
PartitionUpdate.SimpleBuilder builder = PartitionUpdate.simpleBuilder(metadata, dkey).timestamp(now);
builder.row("column0").add("val", "value0");
Hint hint = Hint.create(builder.buildAsMutation(), now);
HintsService.instance.write(hostId, hint);
}
return spy;
}
Aggregations