Search in sources :

Example 1 with PartitionReplicationEvent

use of com.hazelcast.spi.PartitionReplicationEvent in project hazelcast by hazelcast.

the class MigrationRequestOperation method prepareMigrationOperations.

private Collection<Operation> prepareMigrationOperations() {
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    PartitionReplicationEvent replicationEvent = new PartitionReplicationEvent(migrationInfo.getPartitionId(), migrationInfo.getDestinationNewReplicaIndex());
    Collection<Operation> tasks = new LinkedList<Operation>();
    for (ServiceInfo serviceInfo : nodeEngine.getServiceInfos(MigrationAwareService.class)) {
        MigrationAwareService service = (MigrationAwareService) serviceInfo.getService();
        Operation op = service.prepareReplicationOperation(replicationEvent);
        if (op != null) {
            op.setServiceName(serviceInfo.getName());
            tasks.add(op);
        }
    }
    return tasks;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ServiceInfo(com.hazelcast.spi.impl.servicemanager.ServiceInfo) MigrationAwareService(com.hazelcast.spi.MigrationAwareService) Operation(com.hazelcast.spi.Operation) PartitionReplicationEvent(com.hazelcast.spi.PartitionReplicationEvent) LinkedList(java.util.LinkedList)

Example 2 with PartitionReplicationEvent

use of com.hazelcast.spi.PartitionReplicationEvent in project hazelcast by hazelcast.

the class ReplicaSyncRequest method createReplicationOperations.

private List<Operation> createReplicationOperations() {
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    Collection<ServiceInfo> services = nodeEngine.getServiceInfos(MigrationAwareService.class);
    PartitionReplicationEvent event = new PartitionReplicationEvent(getPartitionId(), getReplicaIndex());
    List<Operation> tasks = new LinkedList<Operation>();
    for (ServiceInfo serviceInfo : services) {
        MigrationAwareService service = (MigrationAwareService) serviceInfo.getService();
        Operation op = service.prepareReplicationOperation(event);
        if (op != null) {
            op.setServiceName(serviceInfo.getName());
            tasks.add(op);
        }
    }
    return tasks;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) ServiceInfo(com.hazelcast.spi.impl.servicemanager.ServiceInfo) MigrationAwareService(com.hazelcast.spi.MigrationAwareService) PartitionAwareOperation(com.hazelcast.spi.PartitionAwareOperation) MigrationCycleOperation(com.hazelcast.internal.partition.MigrationCycleOperation) Operation(com.hazelcast.spi.Operation) PartitionReplicationEvent(com.hazelcast.spi.PartitionReplicationEvent) LinkedList(java.util.LinkedList)

Aggregations

MigrationAwareService (com.hazelcast.spi.MigrationAwareService)2 Operation (com.hazelcast.spi.Operation)2 PartitionReplicationEvent (com.hazelcast.spi.PartitionReplicationEvent)2 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)2 ServiceInfo (com.hazelcast.spi.impl.servicemanager.ServiceInfo)2 LinkedList (java.util.LinkedList)2 MigrationCycleOperation (com.hazelcast.internal.partition.MigrationCycleOperation)1 PartitionAwareOperation (com.hazelcast.spi.PartitionAwareOperation)1