protected Observable < AsyncN1qlQueryResult > retryPrepareAndExecuteOnce ( Throwable error , N1qlQuery query , CouchbaseEnvironment env , long timeout , TimeUnit timeUnit ) { if ( error instanceof QueryExecutionException && shouldRetry ( ( ( QueryExecutionException ) error ) . getN1qlError ( ) ) ) { queryCache . remove ( query . statement ( ) . toString ( ) ) ; return prepareAndExecute ( query , env , timeout , timeUnit ) ; } return Observable . error ( error ) ; }
In case the error warrants a retry issue a PREPARE followed by an update of the cache and an EXECUTE . Any failure in the EXECUTE won t continue the retry cycle .