Search in sources :

Example 1 with ChunkedMigrationAwareService

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

the class AbstractPartitionOperation method collectChunkSuppliers.

@Nonnull
final Collection<ChunkSupplier> collectChunkSuppliers(PartitionReplicationEvent event, Collection<String> serviceNames, ServiceNamespace namespace) {
    ILogger logger = getLogger();
    logger.fine("Collecting chunk suppliers...");
    Collection<ChunkSupplier> chunkSuppliers = emptyList();
    NodeEngine nodeEngine = getNodeEngine();
    for (String serviceName : serviceNames) {
        Object service = nodeEngine.getService(serviceName);
        if (!(service instanceof ChunkedMigrationAwareService)) {
            // skip not chunked services
            continue;
        }
        chunkSuppliers = collectChunkSuppliers(event, namespace, isRunningOnPartitionThread(), chunkSuppliers, ((ChunkedMigrationAwareService) service));
        if (logger.isFineEnabled()) {
            logger.fine(String.format("Created chunk supplier:[%s, partitionId:%d]", namespace, 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) Nonnull(javax.annotation.Nonnull)

Example 2 with ChunkedMigrationAwareService

use of com.hazelcast.internal.partition.ChunkedMigrationAwareService 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

ChunkSupplier (com.hazelcast.internal.partition.ChunkSupplier)2 ChunkedMigrationAwareService (com.hazelcast.internal.partition.ChunkedMigrationAwareService)2 ILogger (com.hazelcast.logging.ILogger)2 NodeEngine (com.hazelcast.spi.impl.NodeEngine)2 Nonnull (javax.annotation.Nonnull)2 NonFragmentedServiceNamespace (com.hazelcast.internal.partition.NonFragmentedServiceNamespace)1