public class ClusterJoinManager extends Object
Modifier and Type | Method and Description |
---|---|
void |
answerWhoisMasterQuestion(JoinMessage joinMessage,
Connection connection)
Respond to a
WhoisMasterOp . |
void |
handleJoinRequest(JoinRequest joinRequest,
Connection connection)
Handle a
JoinRequestOp . |
void |
handleMasterResponse(Address masterAddress,
Address callerAddress)
Set master address, if required.
|
boolean |
sendJoinRequest(Address toAddress,
boolean withCredentials)
Send join request to
toAddress . |
boolean |
sendMasterQuestion(Address toAddress)
Send a
WhoisMasterOp to designated address. |
boolean |
setThisMemberAsMaster() |
SplitBrainJoinMessage.SplitBrainMergeCheckResult |
shouldMerge(SplitBrainJoinMessage joinMessage) |
boolean |
validateJoinMessage(JoinMessage joinMessage)
Validate that the configuration received from the remote node in
joinMessage is compatible with the
configuration of this node. |
public void handleJoinRequest(JoinRequest joinRequest, Connection connection)
JoinRequestOp
. If this node is not master, reply with a MasterResponseOp
to let the
joining node know the current master. Otherwise, if no other join is in progress, execute the JoinRequest
joinRequest
- the join requestconnection
- the connection to the joining nodeJoinRequestOp
public boolean validateJoinMessage(JoinMessage joinMessage) throws Exception
joinMessage
is compatible with the
configuration of this node.joinMessage
- the JoinMessage
received from another node.true
if packet version of join message matches this node's packet version and configurations
are found to be compatible, otherwise false
.Exception
- in case any exception occurred while checking compatibiltyConfigCheck
public boolean sendJoinRequest(Address toAddress, boolean withCredentials)
toAddress
.toAddress
- the currently known master address.withCredentials
- use cluster credentialstrue
if join request was sent successfully, otherwise false
.public boolean setThisMemberAsMaster()
public void handleMasterResponse(Address masterAddress, Address callerAddress)
masterAddress
- address of cluster's master, as provided in MasterResponseOp
callerAddress
- address of node that sent the MasterResponseOp
MasterResponseOp
public boolean sendMasterQuestion(Address toAddress)
WhoisMasterOp
to designated address.toAddress
- the address to which the operation will be sent.true
if the operation was sent, otherwise false
.public void answerWhoisMasterQuestion(JoinMessage joinMessage, Connection connection)
WhoisMasterOp
.joinMessage
- the JoinMessage
from the request.connection
- the connection to operation caller, to which response will be sent.WhoisMasterOp
public SplitBrainJoinMessage.SplitBrainMergeCheckResult shouldMerge(SplitBrainJoinMessage joinMessage)
Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.