Class AbstractTarantoolConnectionManager
- java.lang.Object
-
- io.tarantool.driver.core.connection.AbstractTarantoolConnectionManager
-
- All Implemented Interfaces:
TarantoolConnectionManager,AutoCloseable
- Direct Known Subclasses:
TarantoolClusterConnectionManager
public abstract class AbstractTarantoolConnectionManager extends Object implements TarantoolConnectionManager
Contains basic connection establishing and selection strategy invocation algorithms. Subclasses must implement the retrieving of Tarantool server addresses.
-
-
Constructor Summary
Constructors Constructor Description AbstractTarantoolConnectionManager(TarantoolClientConfig config, TarantoolConnectionFactory connectionFactory, TarantoolConnectionListeners connectionListeners)Basic constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()protected abstract Collection<TarantoolServerAddress>getAddresses()Get server addresses to connect to.CompletableFuture<TarantoolConnection>getConnection()Get an established connection according to the order provided by specified connection selection strategy.booleanrefresh()Starts the process of establishing lacking connections to each host
-
-
-
Constructor Detail
-
AbstractTarantoolConnectionManager
public AbstractTarantoolConnectionManager(TarantoolClientConfig config, TarantoolConnectionFactory connectionFactory, TarantoolConnectionListeners connectionListeners)
Basic constructor- Parameters:
config- Tarantool client configconnectionFactory- connection factoryconnectionListeners- connection listeners
-
-
Method Detail
-
getAddresses
protected abstract Collection<TarantoolServerAddress> getAddresses()
Get server addresses to connect to. They must belong to one cluster and contain the information necessary for the internalConnectionSelectionStrategyinstance.- Returns:
- Tarantool server addresses
-
getConnection
public CompletableFuture<TarantoolConnection> getConnection()
Description copied from interface:TarantoolConnectionManagerGet an established connection according to the order provided by specified connection selection strategy. If the connection procedure hasn't been performed yet, starts it.- Specified by:
getConnectionin interfaceTarantoolConnectionManager- Returns:
- a future with next connection in order
-
refresh
public boolean refresh()
Description copied from interface:TarantoolConnectionManagerStarts the process of establishing lacking connections to each host- Specified by:
refreshin interfaceTarantoolConnectionManager- Returns:
- returns true if the establishing process has been started, else false
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
-