Interface ReconnectionPolicy
-
- All Known Implementing Classes:
ConstantReconnectionPolicy,ExponentialReconnectionPolicy
public interface ReconnectionPolicyPolicy that decides how often the reconnection to a dead node is attempted.Each time a node is detected dead (because a connection error occurs), a new
ReconnectionScheduleinstance is created (through thenewSchedule()). Then each call to theReconnectionPolicy.ReconnectionSchedule.nextDelayMs()method of this instance will decide when the next reconnection attempt to this node will be tried.Note that if the driver receives a push notification from the Cassandra cluster that a node is UP, any existing
ReconnectionScheduleon that node will be cancelled and a new one will be created (in effect, the driver reset the scheduler).The default
ExponentialReconnectionPolicypolicy is usually adequate.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceReconnectionPolicy.ReconnectionScheduleSchedules reconnection attempts to a node.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Gets invoked at cluster shutdown.voidinit(Cluster cluster)Gets invoked at cluster startup.ReconnectionPolicy.ReconnectionSchedulenewSchedule()Creates a new schedule for reconnection attempts.
-
-
-
Method Detail
-
newSchedule
ReconnectionPolicy.ReconnectionSchedule newSchedule()
Creates a new schedule for reconnection attempts.- Returns:
- the created schedule.
-
init
void init(Cluster cluster)
Gets invoked at cluster startup.- Parameters:
cluster- the cluster that this policy is associated with.
-
close
void close()
Gets invoked at cluster shutdown.This gives the policy the opportunity to perform some cleanup, for instance stop threads that it might have started.
-
-