public class SplitBrainProtectionServiceImpl extends Object implements EventPublishingService<SplitBrainProtectionEvent,SplitBrainProtectionListener>, MembershipAwareService, SplitBrainProtectionService, HeartbeatAware, PingAware
| Modifier and Type | Field and Description |
|---|---|
static String |
SERVICE_NAME |
| Constructor and Description |
|---|
SplitBrainProtectionServiceImpl(NodeEngineImpl nodeEngine) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSplitBrainProtectionListener(String name,
SplitBrainProtectionListener listener) |
void |
dispatchEvent(SplitBrainProtectionEvent event,
SplitBrainProtectionListener listener)
Notifies the service of a published event.
|
void |
ensureNoSplitBrain(Operation op)
Ensures that the split brain protection for the given operation is present.
|
void |
ensureNoSplitBrain(String splitBrainProtectionName,
SplitBrainProtectionOn requiredSplitBrainProtectionPermissionType)
Ensures that the split brain protection with the given name is present.
|
SplitBrainProtection |
getSplitBrainProtection(String splitBrainProtectionName)
Returns the
SplitBrainProtection instance for a given split brain protection 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
SplitBrainProtectionFunction of ping loss. |
void |
onPingRestored(Member member)
Notifies the
SplitBrainProtectionFunction of a successful ping after one or more pings to that member were lost. |
void |
start() |
public static final String SERVICE_NAME
public SplitBrainProtectionServiceImpl(NodeEngineImpl nodeEngine)
public void start()
public void addSplitBrainProtectionListener(String name, SplitBrainProtectionListener listener)
public void ensureNoSplitBrain(Operation op)
SplitBrainProtectionAwareService.op - the operation for which the minimum cluster size property should be satisfiedSplitBrainProtectionException - if the operation requires a split brain protection
and the minimum cluster size property is not satisfiedpublic void ensureNoSplitBrain(String splitBrainProtectionName, SplitBrainProtectionOn requiredSplitBrainProtectionPermissionType)
SplitBrainProtectionServiceensureNoSplitBrain in interface SplitBrainProtectionServicesplitBrainProtectionName - split brain protection name to ensure, can be null or emptyrequiredSplitBrainProtectionPermissionType - type of split brain protection requiredpublic void dispatchEvent(SplitBrainProtectionEvent event, SplitBrainProtectionListener listener)
EventPublishingServicedispatchEvent in interface EventPublishingService<SplitBrainProtectionEvent,SplitBrainProtectionListener>event - the published eventlistener - the listener registered for this eventpublic void memberAdded(MembershipServiceEvent event)
MembershipAwareServicememberAdded in interface MembershipAwareServiceevent - the event for a new member added to the clusterpublic void memberRemoved(MembershipServiceEvent event)
MembershipAwareServicememberRemoved in interface MembershipAwareServiceevent - the event for an existing member leaving the clusterpublic void memberAttributeChanged(MemberAttributeServiceEvent event)
MembershipAwareServicememberAttributeChanged in interface MembershipAwareServiceevent - the event for a member attribute being changedpublic SplitBrainProtection getSplitBrainProtection(String splitBrainProtectionName)
SplitBrainProtectionServiceSplitBrainProtection instance for a given split brain protection name.getSplitBrainProtection in interface SplitBrainProtectionServicesplitBrainProtectionName - name of the split brain protectionSplitBrainProtectionpublic void onHeartbeat(Member member, long timestamp)
HeartbeatAwareSplitBrainProtectionFunction.apply(Collection) so the SplitBrainProtectionFunction can update
its internal state before deciding on whether the minimum cluster size property
(for the purpose of split brain detection) is satisfied.onHeartbeat in interface HeartbeatAwaremember - member from which heartbeat was receivedtimestamp - timestmap on which heartbeat was receivedpublic void onPingLost(Member member)
PingAwareSplitBrainProtectionFunction of ping loss.onPingLost in interface PingAwaremember - member which was not pinged successfullypublic void onPingRestored(Member member)
PingAwareSplitBrainProtectionFunction of a successful ping after one or more pings to that member were lost.onPingRestored in interface PingAwaremember - member which was pinged successfullyCopyright © 2019 Hazelcast, Inc.. All rights reserved.