public class QuorumServiceImpl extends Object implements EventPublishingService<QuorumEvent,QuorumListener>, MembershipAwareService, QuorumService, HeartbeatAware, PingAware
Modifier and Type | Field and Description |
---|---|
static String |
SERVICE_NAME |
Constructor and Description |
---|
QuorumServiceImpl(NodeEngineImpl nodeEngine) |
Modifier and Type | Method and Description |
---|---|
void |
addQuorumListener(String name,
QuorumListener listener) |
void |
dispatchEvent(QuorumEvent event,
QuorumListener listener)
Notifies the service of a published event.
|
void |
ensureQuorumPresent(Operation op)
Ensures that the quorum for the given operation is present.
|
void |
ensureQuorumPresent(String quorumName,
QuorumType requiredQuorumPermissionType)
Ensures that the quorum with the given name is present.
|
Quorum |
getQuorum(String quorumName)
Returns the
Quorum instance for a given quorum name. |
void |
memberAdded(MembershipServiceEvent event)
Invoked when a new member is added to the cluster.
|
void |
memberAttributeChanged(MemberAttributeServiceEvent event)
Invoked when a member attribute is changed.
|
void |
memberRemoved(MembershipServiceEvent event)
Invoked when an existing member leaves the cluster.
|
void |
onHeartbeat(Member member,
long timestamp)
Notifies of a received heartbeat.
|
void |
onPingLost(Member member)
Notifies the
QuorumFunction of ping loss. |
void |
onPingRestored(Member member)
Notifies the
QuorumFunction of a successful ping after one or more pings to that member were lost. |
void |
start() |
public static final String SERVICE_NAME
public QuorumServiceImpl(NodeEngineImpl nodeEngine)
public void start()
public void addQuorumListener(String name, QuorumListener listener)
public void ensureQuorumPresent(Operation op)
QuorumAwareService
.op
- the operation for which the quorum should be presentQuorumException
- if the operation requires a quorum and the quorum is not presentpublic void ensureQuorumPresent(String quorumName, QuorumType requiredQuorumPermissionType)
QuorumService
ensureQuorumPresent
in interface QuorumService
quorumName
- quorum name to ensure, can be null or emptyrequiredQuorumPermissionType
- type of quorum requiredpublic void dispatchEvent(QuorumEvent event, QuorumListener listener)
EventPublishingService
dispatchEvent
in interface EventPublishingService<QuorumEvent,QuorumListener>
event
- the published eventlistener
- the listener registered for this eventpublic void memberAdded(MembershipServiceEvent event)
MembershipAwareService
memberAdded
in interface MembershipAwareService
event
- the event for a new member added to the clusterpublic void memberRemoved(MembershipServiceEvent event)
MembershipAwareService
memberRemoved
in interface MembershipAwareService
event
- the event for an existing member leaving the clusterpublic void memberAttributeChanged(MemberAttributeServiceEvent event)
MembershipAwareService
memberAttributeChanged
in interface MembershipAwareService
event
- the event for a member attribute being changedpublic Quorum getQuorum(String quorumName)
QuorumService
Quorum
instance for a given quorum name.getQuorum
in interface QuorumService
quorumName
- name of the quorumQuorum
public void onHeartbeat(Member member, long timestamp)
HeartbeatAware
QuorumFunction.apply(Collection)
so
the QuorumFunction
can update its internal state before deciding on quorum presence.onHeartbeat
in interface HeartbeatAware
member
- member from which heartbeat was receivedtimestamp
- timestmap on which heartbeat was receivedpublic void onPingLost(Member member)
PingAware
QuorumFunction
of ping loss.onPingLost
in interface PingAware
member
- member which was not pinged successfullypublic void onPingRestored(Member member)
PingAware
QuorumFunction
of a successful ping after one or more pings to that member were lost.onPingRestored
in interface PingAware
member
- member which was pinged successfullyCopyright © 2021 Hazelcast, Inc.. All Rights Reserved.