public class ClusterJoinManager extends Object
Constructor and Description |
---|
ClusterJoinManager(Node node,
ClusterServiceImpl clusterService,
Lock clusterServiceLock) |
Modifier and Type | Method and Description |
---|---|
void |
answerMasterQuestion(JoinMessage joinMessage,
Connection connection)
Respond to a
MasterDiscoveryOperation . |
void |
handleJoinRequest(JoinRequest joinRequest,
Connection connection)
Handle a
JoinRequestOperation . |
boolean |
isJoinInProgress() |
boolean |
sendJoinRequest(Address toAddress,
boolean withCredentials)
Send join request to
toAddress . |
boolean |
sendMasterQuestion(Address toAddress)
Send a
MasterDiscoveryOperation to designated address. |
boolean |
setAsMaster() |
void |
setMaster(Address masterAddress,
Address callerAddress)
Set master address, if required.
|
boolean |
setMasterAddress(Address master) |
boolean |
validateJoinMessage(JoinMessage joinMessage)
Validate that the configuration received from the remote node in
joinMessage is compatible with the
configuration of this node. |
public ClusterJoinManager(Node node, ClusterServiceImpl clusterService, Lock clusterServiceLock)
public boolean isJoinInProgress()
public void handleJoinRequest(JoinRequest joinRequest, Connection connection)
JoinRequestOperation
. If this node is not master, reply with a SetMasterOperation
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 nodeJoinRequestOperation
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 void setMaster(Address masterAddress, Address callerAddress)
masterAddress
- address of cluster's master, as provided in SetMasterOperation
callerAddress
- address of node that sent the SetMasterOperation
SetMasterOperation
public boolean setMasterAddress(Address master)
public boolean setAsMaster()
public boolean sendMasterQuestion(Address toAddress)
MasterDiscoveryOperation
to designated address.toAddress
- the address to which the operation will be sent.true
if the operation was sent, otherwise false
.public void answerMasterQuestion(JoinMessage joinMessage, Connection connection)
MasterDiscoveryOperation
.joinMessage
- the JoinMessage
from the request.connection
- the connection to operation caller, to which response will be sent.MasterDiscoveryOperation
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.