April 2017
Beginner to intermediate
360 pages
9h 35m
English
Often, queries might fail due to temporary network outages or increased load on a node. It doesn't make sense to fail such queries immediately. Java driver provides a set of policies to ensure queries are retried a certain number of times before throwing exceptions. This accounts for temporary failures. You can create your own retry policy as well.
To set retrypolicy, you will have to use the withRetryPolicy() method of the Cluster.Builder object:
Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").withRetryPolicy(RetryPolicy policy).build();
Here are some of the retry policies available in Java driver:
Read now
Unlock full access