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()
ClusterServiceClusterClock of the cluster.
The returned value will never be null and will never change.getClusterClock in interface ClusterServicepublic String getClusterId()
ClusterServicegetClusterId in interface ClusterServicepublic void setClusterId(String clusterId)
public void init(NodeEngine nodeEngine, Properties properties)
ManagedServiceinit in interface ManagedServicenodeEngine - 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
Exceptionpublic 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()
ManagedServicereset in interface ManagedServicepublic 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 ConnectionListenerpublic void connectionRemoved(Connection connection)
connectionRemoved in interface ConnectionListenerpublic NodeEngineImpl getNodeEngine()
public void sendShutdownMessage()
protected MemberImpl createMember(Address address, String nodeUuid, String ipV6ScopeId, Map<String,Object> attributes)
public MemberImpl getMember(Address address)
ClusterServicegetMember in interface ClusterServiceaddress - the address of the member to lookup.public MemberImpl getMember(String uuid)
ClusterServicegetMember in interface ClusterServiceuuid - the uuid of the memberpublic Collection<MemberImpl> getMemberList()
ClusterServicegetMemberList in interface ClusterServicepublic Set<Member> getMembers()
ClusterServicegetMembers in interface ClusterServicepublic void shutdown(boolean terminate)
ManagedServiceshutdown in interface ManagedServiceterminate - true to shut down the ManagedServicepublic Address getMasterAddress()
ClusterServicegetMasterAddress in interface ClusterServicepublic boolean isMaster()
ClusterServiceisMaster in interface ClusterServicepublic Address getThisAddress()
ClusterServicegetThisAddress in interface ClusterServicepublic Member getLocalMember()
public int getSize()
ClusterServicegetSize in interface ClusterServicepublic 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.