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 void
close()
protected abstract Collection<TarantoolServerAddress>
discoverAddresses()
Collection<TarantoolServerAddress>
getAddresses()
The collection of Tarantool server nodes which belong to the same clusterprotected TarantoolClusterDiscoveryConfig
getDiscoveryConfig()
protected ScheduledExecutorService
getExecutorService()
void
setRefreshCallback(Runnable runnable)
Specify callback for refreshing connections to addresses.protected void
startDiscoveryTask()
-
-
-
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:TarantoolClusterAddressProvider
The collection of Tarantool server nodes which belong to the same cluster- Specified by:
getAddresses
in interfaceTarantoolClusterAddressProvider
- Returns:
- collection of
TarantoolServerAddress
-
setRefreshCallback
public void setRefreshCallback(Runnable runnable)
Description copied from interface:TarantoolClusterAddressProvider
Specify callback for refreshing connections to addresses.For example: can be executed when provider detects changes in the list of server addresses.
- Specified by:
setRefreshCallback
in interfaceTarantoolClusterAddressProvider
- Parameters:
runnable
- callback for running refresh connections
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceTarantoolClusterAddressProvider
-
-