Skip to content

Commit

Permalink
Make node field in JoinRequest private (#36405)
Browse files Browse the repository at this point in the history
This commit moves the node field in the JoinRequest object to be a
private field, adding a dedicated accessor. This is a minor breaking
change in that it is no longer possible for all callers to overwrite
this field, but that is a feature.
  • Loading branch information
jasontedor committed Dec 12, 2018
1 parent dabe29e commit bdb1e0e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public ClusterTasksResult<JoinTaskExecutor.Task> execute(ClusterState currentSta

transportService.registerRequestHandler(MembershipAction.DISCOVERY_JOIN_ACTION_NAME, MembershipAction.JoinRequest::new,
ThreadPool.Names.GENERIC, false, false,
(request, channel, task) -> joinHandler.accept(new JoinRequest(request.node, Optional.empty()), // treat as non-voting join
(request, channel, task) -> joinHandler.accept(new JoinRequest(request.getNode(), Optional.empty()), // treat as non-voting join
transportJoinCallback(request, channel)));

transportService.registerRequestHandler(START_JOIN_ACTION_NAME, Names.GENERIC, false, false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ public void sendValidateJoinRequestBlocking(DiscoveryNode node, ClusterState sta

public static class JoinRequest extends TransportRequest {

public DiscoveryNode node;
private DiscoveryNode node;

public DiscoveryNode getNode() {
return node;
}

public JoinRequest() {
}
Expand All @@ -132,7 +136,7 @@ private class JoinRequestRequestHandler implements TransportRequestHandler<JoinR

@Override
public void messageReceived(final JoinRequest request, final TransportChannel channel, Task task) throws Exception {
listener.onJoin(request.node, new JoinCallback() {
listener.onJoin(request.getNode(), new JoinCallback() {
@Override
public void onSuccess() {
try {
Expand Down

0 comments on commit bdb1e0e

Please sign in to comment.