private PartitionReplicationEvent getPartitionReplicationEvent() { return new PartitionReplicationEvent(migrationInfo.getPartitionId(), migrationInfo.getDestinationNewReplicaIndex()); }
private PartitionReplicationEvent getPartitionReplicationEvent() { return new PartitionReplicationEvent(migrationInfo.getPartitionId(), migrationInfo.getDestinationNewReplicaIndex()); }
final Collection<ServiceNamespace> retainAndGetNamespaces() { PartitionReplicationEvent event = new PartitionReplicationEvent(partitionId, 0); Collection<FragmentedMigrationAwareService> services = nodeEngine.getServices(FragmentedMigrationAwareService.class); Set<ServiceNamespace> namespaces = new HashSet<ServiceNamespace>(); for (FragmentedMigrationAwareService service : services) { Collection<ServiceNamespace> serviceNamespaces = service.getAllServiceNamespaces(event); if (serviceNamespaces != null) { namespaces.addAll(serviceNamespaces); } } namespaces.add(NonFragmentedServiceNamespace.INSTANCE); PartitionReplicaManager replicaManager = partitionService.getReplicaManager(); replicaManager.retainNamespaces(partitionId, namespaces); return replicaManager.getNamespaces(partitionId); }
final Collection<ServiceNamespace> retainAndGetNamespaces() { PartitionReplicationEvent event = new PartitionReplicationEvent(partitionId, 0); Collection<FragmentedMigrationAwareService> services = nodeEngine.getServices(FragmentedMigrationAwareService.class); Set<ServiceNamespace> namespaces = new HashSet<ServiceNamespace>(); for (FragmentedMigrationAwareService service : services) { Collection<ServiceNamespace> serviceNamespaces = service.getAllServiceNamespaces(event); if (serviceNamespaces != null) { namespaces.addAll(serviceNamespaces); } } namespaces.add(NonFragmentedServiceNamespace.INSTANCE); PartitionReplicaManager replicaManager = partitionService.getReplicaManager(); replicaManager.retainNamespaces(partitionId, namespaces); return replicaManager.getNamespaces(partitionId); }
/** * Send responses for first number of {@code permits} namespaces and remove them from the list. */ private void sendOperationsForNamespaces(int permits) { InternalPartitionServiceImpl partitionService = getService(); try { PartitionReplicationEvent event = new PartitionReplicationEvent(getPartitionId(), getReplicaIndex()); Iterator<ServiceNamespace> iterator = namespaces.iterator(); for (int i = 0; i < permits; i++) { ServiceNamespace namespace = iterator.next(); Collection<Operation> operations; if (NonFragmentedServiceNamespace.INSTANCE.equals(namespace)) { operations = createNonFragmentedReplicationOperations(event); } else { operations = createFragmentReplicationOperations(event, namespace); } sendOperations(operations, namespace); iterator.remove(); } } finally { partitionService.getReplicaManager().releaseReplicaSyncPermits(permits); } }
/** * Send responses for first number of {@code permits} namespaces and remove them from the list. */ private void sendOperationsForNamespaces(int permits) { InternalPartitionServiceImpl partitionService = getService(); try { PartitionReplicationEvent event = new PartitionReplicationEvent(getPartitionId(), getReplicaIndex()); Iterator<ServiceNamespace> iterator = namespaces.iterator(); for (int i = 0; i < permits; i++) { ServiceNamespace namespace = iterator.next(); Collection<Operation> operations; if (NonFragmentedServiceNamespace.INSTANCE.equals(namespace)) { operations = createNonFragmentedReplicationOperations(event); } else { operations = createFragmentReplicationOperations(event, namespace); } sendOperations(operations, namespace); iterator.remove(); } } finally { partitionService.getReplicaManager().releaseReplicaSyncPermits(permits); } }