use of com.hazelcast.internal.services.SplitBrainProtectionAwareService in project hazelcast by hazelcast.
the class SplitBrainProtectionServiceImpl method findSplitBrainProtection.
/**
* Returns a {@link SplitBrainProtectionImpl} for the given operation. The operation should be named and the
* operation service should be a {@link SplitBrainProtectionAwareService}. This service will then return the
* split brain protection configured under the name returned by the operation service.
*
* @param op the operation for which the SplitBrainProtection should be returned
* @return the split brain protection
*/
private SplitBrainProtectionImpl findSplitBrainProtection(Operation op) {
if (!isNamedOperation(op)) {
return null;
}
SplitBrainProtectionAwareService service = getSplitBrainProtectionAwareService(op);
if (service == null) {
return null;
}
String name = ((NamedOperation) op).getName();
String splitBrainProtectionName = service.getSplitBrainProtectionName(name);
if (splitBrainProtectionName == null) {
return null;
}
return splitBrainProtections.get(splitBrainProtectionName);
}
use of com.hazelcast.internal.services.SplitBrainProtectionAwareService in project hazelcast by hazelcast.
the class SplitBrainProtectionServiceImpl method getSplitBrainProtectionAwareService.
private SplitBrainProtectionAwareService getSplitBrainProtectionAwareService(Operation op) {
Object service;
if (op instanceof ServiceNamespaceAware) {
ServiceNamespace serviceNamespace = ((ServiceNamespaceAware) op).getServiceNamespace();
service = nodeEngine.getService(serviceNamespace.getServiceName());
} else {
service = op.getService();
}
if (service instanceof SplitBrainProtectionAwareService) {
return (SplitBrainProtectionAwareService) service;
}
return null;
}
Aggregations