Search in sources :

Example 1 with ServiceNamespaceAware

use of com.hazelcast.internal.services.ServiceNamespaceAware in project hazelcast by hazelcast.

the class OperationBackupHandler method checkServiceNamespaces.

private void checkServiceNamespaces(BackupAwareOperation backupAwareOp, Operation backupOp) {
    Operation op = (Operation) backupAwareOp;
    Object service;
    try {
        service = op.getService();
    } catch (Exception ignored) {
        // operation doesn't know its service name
        return;
    }
    if (service instanceof FragmentedMigrationAwareService) {
        assert backupAwareOp instanceof ServiceNamespaceAware : service + " is instance of FragmentedMigrationAwareService, " + backupAwareOp + " should implement ServiceNamespaceAware!";
        assert backupOp instanceof ServiceNamespaceAware : service + " is instance of FragmentedMigrationAwareService, " + backupOp + " should implement ServiceNamespaceAware!";
    } else {
        assert !(backupAwareOp instanceof ServiceNamespaceAware) : service + " is NOT instance of FragmentedMigrationAwareService, " + backupAwareOp + " should NOT implement ServiceNamespaceAware!";
        assert !(backupOp instanceof ServiceNamespaceAware) : service + " is NOT instance of FragmentedMigrationAwareService, " + backupOp + " should NOT implement ServiceNamespaceAware!";
    }
}
Also used : ServiceNamespaceAware(com.hazelcast.internal.services.ServiceNamespaceAware) BackupAwareOperation(com.hazelcast.spi.impl.operationservice.BackupAwareOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) FragmentedMigrationAwareService(com.hazelcast.internal.partition.FragmentedMigrationAwareService)

Example 2 with ServiceNamespaceAware

use of com.hazelcast.internal.services.ServiceNamespaceAware 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;
}
Also used : ServiceNamespaceAware(com.hazelcast.internal.services.ServiceNamespaceAware) SplitBrainProtectionAwareService(com.hazelcast.internal.services.SplitBrainProtectionAwareService) ServiceNamespace(com.hazelcast.internal.services.ServiceNamespace)

Aggregations

ServiceNamespaceAware (com.hazelcast.internal.services.ServiceNamespaceAware)2 FragmentedMigrationAwareService (com.hazelcast.internal.partition.FragmentedMigrationAwareService)1 ServiceNamespace (com.hazelcast.internal.services.ServiceNamespace)1 SplitBrainProtectionAwareService (com.hazelcast.internal.services.SplitBrainProtectionAwareService)1 BackupAwareOperation (com.hazelcast.spi.impl.operationservice.BackupAwareOperation)1 Operation (com.hazelcast.spi.impl.operationservice.Operation)1