Make node field in JoinRequest private (#36405)

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.
This commit is contained in:
Jason Tedor 2018-12-12 08:50:21 -05:00 committed by GitHub
parent dabe29e783
commit bdb1e0e04e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -112,7 +112,7 @@ public class JoinHelper {
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,

View File

@ -105,7 +105,11 @@ public class MembershipAction {
public static class JoinRequest extends TransportRequest {
public DiscoveryNode node;
private DiscoveryNode node;
public DiscoveryNode getNode() {
return node;
}
public JoinRequest() {
}
@ -132,7 +136,7 @@ public class MembershipAction {
@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 {