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)
SplitBrainProtectionService
ensureNoSplitBrain
in interface SplitBrainProtectionService
splitBrainProtectionName
- split brain protection name to ensure, can be null or emptyrequiredSplitBrainProtectionPermissionType
- type of split brain protection requiredpublic void dispatchEvent(SplitBrainProtectionEvent event, SplitBrainProtectionListener listener)
EventPublishingService
dispatchEvent
in interface EventPublishingService<SplitBrainProtectionEvent,SplitBrainProtectionListener>
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 SplitBrainProtection getSplitBrainProtection(String splitBrainProtectionName)
SplitBrainProtectionService
SplitBrainProtection
instance for a given split brain protection name.getSplitBrainProtection
in interface SplitBrainProtectionService
splitBrainProtectionName
- name of the split brain protectionSplitBrainProtection
public void onHeartbeat(Member member, long timestamp)
HeartbeatAware
SplitBrainProtectionFunction.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 HeartbeatAware
member
- member from which heartbeat was receivedtimestamp
- timestmap on which heartbeat was receivedpublic void onPingLost(Member member)
PingAware
SplitBrainProtectionFunction
of ping loss.onPingLost
in interface PingAware
member
- member which was not pinged successfullypublic void onPingRestored(Member member)
PingAware
SplitBrainProtectionFunction
of a successful ping after one or more pings to that member were lost.onPingRestored
in interface PingAware
member
- member which was pinged successfullyCopyright © 2019 Hazelcast, Inc.. All rights reserved.