Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,24 @@ public void counterIncrement() throws IOException {
}

public void queryCounter() throws IOException {
RaftClient client = createClient();
try {
RaftClientReply reply = client.io().sendReadOnly(CounterCommand.GET.getMessage());
String count = reply.getMessage().getContent().toStringUtf8();
System.out.println("Current counter value: " + count);
} finally {
client.close();
}
RaftClient client = createClient();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: wrong indents

try {
Comment on lines +146 to +147
RaftClientReply reply = client.io().sendReadOnly(
CounterCommand.GET.getMessage());
Comment on lines +146 to +149

ByteBuffer buffer =
reply.getMessage()
.getContent()
.asReadOnlyByteBuffer();

int count = buffer.getInt();
Comment on lines +148 to +156

System.out.println(
"Current counter value: " + count);
} finally {
client.close();
}
}

/**
* Configure the raft group with initial peers.
Expand Down