Search in sources :

Example 1 with NonFragmentedServiceNamespace

use of com.hazelcast.internal.partition.NonFragmentedServiceNamespace in project hazelcast by hazelcast.

the class AbstractPartitionOperation method createFragmentReplicationOperationsOffload.

/**
 * Used for partition replica sync, supporting
 * offloaded replication-operation preparation
 */
final Collection<Operation> createFragmentReplicationOperationsOffload(PartitionReplicationEvent event, ServiceNamespace ns) {
    assert !(ns instanceof NonFragmentedServiceNamespace) : ns + " should be used only for fragmented services!";
    Collection<Operation> operations = emptySet();
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    Collection<ServiceInfo> services = nodeEngine.getServiceInfos(FragmentedMigrationAwareService.class);
    for (ServiceInfo serviceInfo : services) {
        FragmentedMigrationAwareService service = serviceInfo.getService();
        if (!service.isKnownServiceNamespace(ns)) {
            continue;
        }
        operations = collectReplicationOperations(event, ns, isRunningOnPartitionThread(), operations, serviceInfo.getName(), service);
    }
    return operations;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ServiceInfo(com.hazelcast.spi.impl.servicemanager.ServiceInfo) Operation(com.hazelcast.spi.impl.operationservice.Operation) FragmentedMigrationAwareService(com.hazelcast.internal.partition.FragmentedMigrationAwareService) NonFragmentedServiceNamespace(com.hazelcast.internal.partition.NonFragmentedServiceNamespace)

Example 2 with NonFragmentedServiceNamespace

use of com.hazelcast.internal.partition.NonFragmentedServiceNamespace in project hazelcast by hazelcast.

the class AbstractPartitionOperation method createFragmentReplicationOperationsOffload.

/**
 * Used for offloaded replication-operation
 * preparation while executing a migration request
 */
final Collection<Operation> createFragmentReplicationOperationsOffload(PartitionReplicationEvent event, ServiceNamespace ns, Collection<String> serviceNames) {
    assert !(ns instanceof NonFragmentedServiceNamespace) : ns + " should be used only for fragmented services!";
    Collection<Operation> operations = emptySet();
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    for (String serviceName : serviceNames) {
        FragmentedMigrationAwareService service = nodeEngine.getService(serviceName);
        assert service.isKnownServiceNamespace(ns) : ns + " should be known by " + service;
        operations = collectReplicationOperations(event, ns, isRunningOnPartitionThread(), operations, serviceName, service);
    }
    return operations;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Operation(com.hazelcast.spi.impl.operationservice.Operation) FragmentedMigrationAwareService(com.hazelcast.internal.partition.FragmentedMigrationAwareService) NonFragmentedServiceNamespace(com.hazelcast.internal.partition.NonFragmentedServiceNamespace)

Example 3 with NonFragmentedServiceNamespace

use of com.hazelcast.internal.partition.NonFragmentedServiceNamespace in project hazelcast by hazelcast.

the class AbstractPartitionOperation method createFragmentReplicationOperations.

final Collection<Operation> createFragmentReplicationOperations(PartitionReplicationEvent event, ServiceNamespace ns) {
    assert !(ns instanceof NonFragmentedServiceNamespace) : ns + " should be used only for fragmented services!";
    assertRunningOnPartitionThread();
    Collection<Operation> operations = emptySet();
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    Collection<ServiceInfo> services = nodeEngine.getServiceInfos(FragmentedMigrationAwareService.class);
    for (ServiceInfo serviceInfo : services) {
        FragmentedMigrationAwareService service = serviceInfo.getService();
        if (!service.isKnownServiceNamespace(ns)) {
            continue;
        }
        operations = prepareAndAppendReplicationOperation(event, ns, service, serviceInfo.getName(), operations);
    }
    return operations;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ServiceInfo(com.hazelcast.spi.impl.servicemanager.ServiceInfo) Operation(com.hazelcast.spi.impl.operationservice.Operation) FragmentedMigrationAwareService(com.hazelcast.internal.partition.FragmentedMigrationAwareService) NonFragmentedServiceNamespace(com.hazelcast.internal.partition.NonFragmentedServiceNamespace)

Example 4 with NonFragmentedServiceNamespace

use of com.hazelcast.internal.partition.NonFragmentedServiceNamespace in project hazelcast by hazelcast.

the class AbstractPartitionOperation method collectChunkSuppliers.

@Nonnull
final Collection<ChunkSupplier> collectChunkSuppliers(PartitionReplicationEvent event, ServiceNamespace ns) {
    assert !(ns instanceof NonFragmentedServiceNamespace) : ns + " should be used only for chunked migrations enabled services!";
    ILogger logger = getLogger();
    logger.fine("Collecting chunk chunk suppliers...");
    Collection<ChunkSupplier> chunkSuppliers = Collections.emptyList();
    NodeEngine nodeEngine = getNodeEngine();
    Collection<ChunkedMigrationAwareService> services = nodeEngine.getServices(ChunkedMigrationAwareService.class);
    for (ChunkedMigrationAwareService service : services) {
        if (!service.isKnownServiceNamespace(ns)) {
            continue;
        }
        chunkSuppliers = collectChunkSuppliers(event, ns, isRunningOnPartitionThread(), chunkSuppliers, service);
        if (logger.isFineEnabled()) {
            logger.fine(String.format("Created chunk supplier:[%s, partitionId:%d]", ns, event.getPartitionId()));
        }
    }
    return chunkSuppliers;
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) ChunkedMigrationAwareService(com.hazelcast.internal.partition.ChunkedMigrationAwareService) ChunkSupplier(com.hazelcast.internal.partition.ChunkSupplier) ILogger(com.hazelcast.logging.ILogger) NonFragmentedServiceNamespace(com.hazelcast.internal.partition.NonFragmentedServiceNamespace) Nonnull(javax.annotation.Nonnull)

Aggregations

NonFragmentedServiceNamespace (com.hazelcast.internal.partition.NonFragmentedServiceNamespace)4 FragmentedMigrationAwareService (com.hazelcast.internal.partition.FragmentedMigrationAwareService)3 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)3 Operation (com.hazelcast.spi.impl.operationservice.Operation)3 ServiceInfo (com.hazelcast.spi.impl.servicemanager.ServiceInfo)2 ChunkSupplier (com.hazelcast.internal.partition.ChunkSupplier)1 ChunkedMigrationAwareService (com.hazelcast.internal.partition.ChunkedMigrationAwareService)1 ILogger (com.hazelcast.logging.ILogger)1 NodeEngine (com.hazelcast.spi.impl.NodeEngine)1 Nonnull (javax.annotation.Nonnull)1