I'm trying to speed up our code by calling session.executeAsync()
instead of session.execute()
for DB writes.
We have use cases where the DB connection might be down, currently the previous execute()
throws an exception when the connection is lost (no hosts reachable in the cluster). We can catch these exceptions and retry or save the data somewhere else etc...
With executeAsync()
, it doesn't look like there's any way to fulfill this use case - the returned ResultSetFuture
object needs to be accessed to check the result, which would defeat the purpose of using the executeAsync()
in the first place...
Is there any way to add a listener (or something similar) anywhere for the executeAsync() call that will asynchronously notify some other code that a DB write has failed?
Is this pertinent? Datastax 1.0.2 Java 1.7.40