Search in sources :

Example 1 with NamedOperation

use of com.hazelcast.spi.impl.operationservice.NamedOperation 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);
}
Also used : SplitBrainProtectionAwareService(com.hazelcast.internal.services.SplitBrainProtectionAwareService) NamedOperation(com.hazelcast.spi.impl.operationservice.NamedOperation)

Aggregations

SplitBrainProtectionAwareService (com.hazelcast.internal.services.SplitBrainProtectionAwareService)1 NamedOperation (com.hazelcast.spi.impl.operationservice.NamedOperation)1