All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.redislabs.riot.transfer.TransferExecution Maven / Gradle / Ivy

package com.redislabs.riot.transfer;

import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import lombok.Builder;
import lombok.Singular;

@Builder
public class TransferExecution implements MetricsProvider {

    @Singular
    private List> flows;

    public boolean isTerminated() {
        boolean finished = true;
        for (FlowExecution flowExecution : flows) {
            finished &= flowExecution.isTerminated();
        }
        return finished;
    }

    public void awaitTermination(long timeout, TimeUnit unit) {
        flows.forEach(f -> f.awaitTermination(timeout, unit));
    }

    @Override
    public Metrics getMetrics() {
        return Metrics.builder().metrics(flows.stream().map(f -> f.progress()).collect(Collectors.toList())).build();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy