Package io.tarantool.driver.cluster
Class AbstractDiscoveryClusterAddressProvider
- java.lang.Object
-
- io.tarantool.driver.cluster.AbstractDiscoveryClusterAddressProvider
-
- All Implemented Interfaces:
TarantoolClusterAddressProvider,AutoCloseable
- Direct Known Subclasses:
BinaryDiscoveryClusterAddressProvider,HTTPDiscoveryClusterAddressProvider
public abstract class AbstractDiscoveryClusterAddressProvider extends Object implements TarantoolClusterAddressProvider
Base class offering discovery task creation and updating of the internal collection of addresses
-
-
Constructor Summary
Constructors Constructor Description AbstractDiscoveryClusterAddressProvider(TarantoolClusterDiscoveryConfig discoveryConfig)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()protected abstract Collection<TarantoolServerAddress>discoverAddresses()Collection<TarantoolServerAddress>getAddresses()The collection of Tarantool server nodes which belong to the same clusterprotected TarantoolClusterDiscoveryConfiggetDiscoveryConfig()protected ScheduledExecutorServicegetExecutorService()voidsetRefreshCallback(Runnable runnable)Specify callback for refreshing connections to addresses.protected voidstartDiscoveryTask()
-
-
-
Constructor Detail
-
AbstractDiscoveryClusterAddressProvider
public AbstractDiscoveryClusterAddressProvider(TarantoolClusterDiscoveryConfig discoveryConfig)
-
-
Method Detail
-
startDiscoveryTask
protected void startDiscoveryTask() throws TarantoolClientException- Throws:
TarantoolClientException
-
getDiscoveryConfig
protected TarantoolClusterDiscoveryConfig getDiscoveryConfig()
-
getExecutorService
protected ScheduledExecutorService getExecutorService()
-
discoverAddresses
protected abstract Collection<TarantoolServerAddress> discoverAddresses()
-
getAddresses
public Collection<TarantoolServerAddress> getAddresses()
Description copied from interface:TarantoolClusterAddressProviderThe collection of Tarantool server nodes which belong to the same cluster- Specified by:
getAddressesin interfaceTarantoolClusterAddressProvider- Returns:
- collection of
TarantoolServerAddress
-
setRefreshCallback
public void setRefreshCallback(Runnable runnable)
Description copied from interface:TarantoolClusterAddressProviderSpecify callback for refreshing connections to addresses.For example: can be executed when provider detects changes in the list of server addresses.
- Specified by:
setRefreshCallbackin interfaceTarantoolClusterAddressProvider- Parameters:
runnable- callback for running refresh connections
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceTarantoolClusterAddressProvider
-
-