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

io.lettuce.core.cluster.SyncExecutionsImpl Maven / Gradle / Ivy

Go to download

Advanced and thread-safe Java Redis client for synchronous, asynchronous, and reactive usage. Supports Cluster, Sentinel, Pipelining, Auto-Reconnect, Codecs and much more.

The newest version!
package io.lettuce.core.cluster;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;

import io.lettuce.core.cluster.api.sync.Executions;
import io.lettuce.core.cluster.models.partitions.RedisClusterNode;

/**
 * @author Mark Paluch TODO: Add timeout handling
 */
class SyncExecutionsImpl implements Executions {

    private Map executions;

    public SyncExecutionsImpl(Map> executions)
            throws ExecutionException, InterruptedException {

        Map result = new HashMap<>(executions.size(), 1);
        for (Map.Entry> entry : executions.entrySet()) {
            result.put(entry.getKey(), entry.getValue().toCompletableFuture().get());
        }

        this.executions = result;
    }

    @Override
    public Map asMap() {
        return executions;
    }

    @Override
    public Collection nodes() {
        return executions.keySet();
    }

    @Override
    public T get(RedisClusterNode redisClusterNode) {
        return executions.get(redisClusterNode);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy