I am using DataStax API to read records from Cassandra database,Some times execute method in Session is showing strange behavior. Sometimes it results empty result set, sometimes it returns correct result set.
Here is my code
//Create session instance, using Singleton pattern public synchronized static Static getSession(){ if(session !=null){ //Not sending all the clusters Cluster cluster = Cluster.builder().withPort(myPort).addClusterPoints(clusters).withCredentials("username","password"). withSocketOptions(new SocketOptions().setReadTimeoutMillis(30000).setConnectTimeoutMillis(30000)).build(); session = cluster.connect("database"); } else{ return session; } } //get the session and execute query and return resultset public void executeQuery(){ Session session = getSession(); BoundStatement boundStatement = .. ResultSet result = session.execute(boundStatement); System.out.println(result.isExhausted); // true System.out.println(result.isFullyFetched); // true System.out.println(result.all().size()); /// **0 sometimes, correct count sometimes** } I am not sending all clusters in addClusterPoints due to some reasons. Does it create any problem? But i am getting data some times.