com.hazelcast.cluster.impl
public final class ClusterServiceImpl extends Object implements ClusterService, ConnectionListener, ManagedService, EventPublishingService<MembershipEvent,MembershipListener>
Modifier and Type | Field and Description |
---|---|
static String |
SERVICE_NAME |
protected Address |
thisAddress |
protected MemberImpl |
thisMember |
Constructor and Description |
---|
ClusterServiceImpl(Node node) |
Modifier and Type | Method and Description |
---|---|
void |
acceptMasterConfirmation(MemberImpl member) |
String |
addMembershipListener(MembershipListener listener) |
void |
answerMasterQuestion(JoinMessage joinMessage) |
JoinRequest |
checkJoinInfo(Address target) |
void |
connectionAdded(Connection connection) |
void |
connectionRemoved(Connection connection) |
protected MemberImpl |
createMember(Address address,
String nodeUuid,
String ipV6ScopeId,
Map<String,Object> attributes) |
void |
dispatchEvent(MembershipEvent event,
MembershipListener listener) |
ClusterClockImpl |
getClusterClock()
Returns the
ClusterClock of the cluster. |
String |
getClusterId()
Returns UUID for the cluster.
|
Cluster |
getClusterProxy() |
Member |
getLocalMember() |
Address |
getMasterAddress()
Returns the address of the master member.
|
MemberImpl |
getMember(Address address)
Gets the member for the given address.
|
MemberImpl |
getMember(String uuid)
Gets the member with the given uuid.
|
Collection<MemberImpl> |
getMemberList()
Gets the collection of members.
|
Set<Member> |
getMembers()
Returns a collection of all members part of the cluster.
|
NodeEngineImpl |
getNodeEngine() |
int |
getSize()
Gets the current number of members.
|
Address |
getThisAddress()
Gets the address of this member.
|
void |
handleJoinRequest(JoinRequest joinRequest,
Connection connection) |
void |
handleMaster(Address masterAddress,
Address callerAddress) |
void |
init(NodeEngine nodeEngine,
Properties properties)
Initializes this ManagedService
|
boolean |
isJoinInProgress() |
boolean |
isMaster()
Checks if this member is the master.
|
String |
membersString() |
void |
merge(Address newTargetAddress) |
void |
prepareToMerge(Address newTargetAddress) |
void |
removeAddress(Address deadAddress) |
boolean |
removeMembershipListener(String registrationId) |
void |
reset()
reset this ManagedService back to initial state.
|
boolean |
sendJoinRequest(Address toAddress,
boolean withCredentials) |
boolean |
sendMasterQuestion(Address toAddress) |
void |
sendMemberListToMember(Address target) |
void |
sendShutdownMessage() |
void |
setClusterId(String clusterId) |
void |
shutdown(boolean terminate)
Shuts down this ManagedService.
|
String |
toString() |
void |
updateMemberAttribute(String uuid,
MemberAttributeOperationType operationType,
String key,
Object value) |
void |
updateMembers(Collection<MemberInfo> members) |
boolean |
validateJoinMessage(JoinMessage joinMessage) |
public static final String SERVICE_NAME
protected final Address thisAddress
protected final MemberImpl thisMember
public ClusterServiceImpl(Node node)
public ClusterClockImpl getClusterClock()
ClusterService
ClusterClock
of the cluster.
The returned value will never be null and will never change.getClusterClock
in interface ClusterService
public String getClusterId()
ClusterService
getClusterId
in interface ClusterService
public void setClusterId(String clusterId)
public void init(NodeEngine nodeEngine, Properties properties)
ManagedService
init
in interface ManagedService
nodeEngine
- the NodeEngine that this ManagedService belongs to.properties
- the Properties. Can be used to pass settings to the service.public boolean isJoinInProgress()
public JoinRequest checkJoinInfo(Address target)
public boolean validateJoinMessage(JoinMessage joinMessage) throws Exception
Exception
public void sendMemberListToMember(Address target)
public void removeAddress(Address deadAddress)
public void answerMasterQuestion(JoinMessage joinMessage)
public void handleJoinRequest(JoinRequest joinRequest, Connection connection)
public void acceptMasterConfirmation(MemberImpl member)
public void prepareToMerge(Address newTargetAddress)
public void merge(Address newTargetAddress)
public void reset()
ManagedService
reset
in interface ManagedService
public void updateMembers(Collection<MemberInfo> members)
public void updateMemberAttribute(String uuid, MemberAttributeOperationType operationType, String key, Object value)
public boolean sendJoinRequest(Address toAddress, boolean withCredentials)
public boolean sendMasterQuestion(Address toAddress)
public void connectionAdded(Connection connection)
connectionAdded
in interface ConnectionListener
public void connectionRemoved(Connection connection)
connectionRemoved
in interface ConnectionListener
public NodeEngineImpl getNodeEngine()
public void sendShutdownMessage()
protected MemberImpl createMember(Address address, String nodeUuid, String ipV6ScopeId, Map<String,Object> attributes)
public MemberImpl getMember(Address address)
ClusterService
getMember
in interface ClusterService
address
- the address of the member to lookup.public MemberImpl getMember(String uuid)
ClusterService
getMember
in interface ClusterService
uuid
- the uuid of the memberpublic Collection<MemberImpl> getMemberList()
ClusterService
getMemberList
in interface ClusterService
public Set<Member> getMembers()
ClusterService
getMembers
in interface ClusterService
public void shutdown(boolean terminate)
ManagedService
shutdown
in interface ManagedService
terminate
- true to shut down the ManagedServicepublic Address getMasterAddress()
ClusterService
getMasterAddress
in interface ClusterService
public boolean isMaster()
ClusterService
isMaster
in interface ClusterService
public Address getThisAddress()
ClusterService
getThisAddress
in interface ClusterService
public Member getLocalMember()
public int getSize()
ClusterService
getSize
in interface ClusterService
public String addMembershipListener(MembershipListener listener)
public boolean removeMembershipListener(String registrationId)
public void dispatchEvent(MembershipEvent event, MembershipListener listener)
dispatchEvent
in interface EventPublishingService<MembershipEvent,MembershipListener>
public Cluster getClusterProxy()
public String membersString()
Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.