I'm using the datastax driver for java:
@Dao
public interface MyDao {
@Insert
CompletableFuture<Void> save(MyEntity entity);
...
}
public class MyDaoTests {
@Test
public void myTest() {
...
List<CompletableFuture<Void>> futureList = myEntityList.parallelStream()
.map((myEntity) -> meterDataMapper.myDao().save(myEntity))
.collect(Collectors.toList());
CompletableFuture.allOf(futureList.toArray(CompletableFuture[]::new)).join();
...
}
}
When I execute the test, I get this error:
java.util.concurrent.CompletionException: com.datastax.oss.driver.api.core.NoNodeAvailableException: No node was available to execute the query
Is there a way to configure the driver/session to wait for available nodes?
Further information:
- My test size is about 2500000 entities (
myEntityList). - Synchronous inserts work fine, but they're way too slow.
- I want to solve this with the datastax-java-driver mapper, annotation-based, as simple as possible.
- Driver Version: 4.9.0