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

io.tarantool.driver.core.TarantoolClusterConnectionManager Maven / Gradle / Ivy

Go to download

Tarantool Cartridge driver for Tarantool versions 1.10+ based on Netty framework

There is a newer version: 0.14.0
Show newest version
package io.tarantool.driver.core;

import io.tarantool.driver.ConnectionSelectionStrategyFactory;
import io.tarantool.driver.TarantoolClientConfig;
import io.tarantool.driver.TarantoolClusterAddressProvider;
import io.tarantool.driver.TarantoolServerAddress;

import java.util.Collection;

/**
 * Implementation of {@link AbstractTarantoolConnectionManager}, aware of connecting to the Tarantool cluster
 *
 * @author Alexey Kuzin
 */
public class TarantoolClusterConnectionManager extends AbstractTarantoolConnectionManager {
    private final TarantoolClusterAddressProvider addressProvider;

    /**
     * Basic constructor.
     *
     * @param config client configuration
     * @param connectionFactory manages instantiation of Tarantool server connections
     * @param selectStrategyFactory manages selection of the next connection from available ones
     * @param listeners are invoked after connection is established
     * @param addressProvider provides Tarantool server nodes addresses
     */
    public TarantoolClusterConnectionManager(TarantoolClientConfig config,
                                             TarantoolConnectionFactory connectionFactory,
                                             ConnectionSelectionStrategyFactory selectStrategyFactory,
                                             TarantoolConnectionListeners listeners,
                                             TarantoolClusterAddressProvider addressProvider) {
        super(config, connectionFactory, selectStrategyFactory, listeners);
        this.addressProvider = addressProvider;
    }

    @Override
    protected Collection getAddresses() {
        return addressProvider.getAddresses();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy