public interface ReconnectionPolicy extends AutoCloseable
When a reconnection starts, the driver invokes this policy to create a ReconnectionSchedule
instance. That schedule's nextDelay()
method will get called each time the driver needs
to program the next connection attempt. When the reconnection succeeds, the schedule is
discarded; if the connection is lost again later, the next reconnection attempt will query the
policy again to obtain a new schedule.
There are two types of reconnection:
advanced.connection.pool.*.size
in the configuration), a reconnection starts for that
pool.
advanced.reconnect-on-init
is set and the
driver has to retry the initial connection.
Modifier and Type | Interface and Description |
---|---|
static interface |
ReconnectionPolicy.ReconnectionSchedule
The reconnection schedule from the time a connection is lost, to the time all connections to
this node have been restored.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Called when the cluster that this policy is associated with closes.
|
ReconnectionPolicy.ReconnectionSchedule |
newControlConnectionSchedule(boolean isInitialConnection)
Creates a new schedule for the control connection.
|
ReconnectionPolicy.ReconnectionSchedule |
newNodeSchedule(Node node)
Creates a new schedule for the given node.
|
@NonNull ReconnectionPolicy.ReconnectionSchedule newNodeSchedule(@NonNull Node node)
@NonNull ReconnectionPolicy.ReconnectionSchedule newControlConnectionSchedule(boolean isInitialConnection)
isInitialConnection
- whether this schedule is generated for the driver's initial attempt
to connect to the cluster.
true
means that the configuration option advanced.reconnect-on-init
is set, the driver failed to reach any contact point, and it is now scheduling
reattempts.
false
means that the driver was already initialized, lost connection to the
control node, and is now scheduling attempts to connect to another node.
void close()
close
in interface AutoCloseable
Copyright © 2017–2024. All rights reserved.