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 void
close()
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.boolean
refresh()
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 internalConnectionSelectionStrategy
instance.- Returns:
- Tarantool server addresses
-
getConnection
public CompletableFuture<TarantoolConnection> getConnection()
Description copied from interface:TarantoolConnectionManager
Get 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:
getConnection
in interfaceTarantoolConnectionManager
- Returns:
- a future with next connection in order
-
refresh
public boolean refresh()
Description copied from interface:TarantoolConnectionManager
Starts the process of establishing lacking connections to each host- Specified by:
refresh
in interfaceTarantoolConnectionManager
- Returns:
- returns true if the establishing process has been started, else false
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
-