I'm trying to build a multithreaded Cassandra importer in Java. I'm using this package:
group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '4.0.0'
Single threaded (using the main thread) works fine but even with 1 subthread I instantly receive com.datastax.oss.driver.api.core.NoNodeAvailableException: No node was available to execute the query
I'm testing my application on a cassandra instance in Docker (hope this is not the problem). This is the builder I have.
session = CqlSession.builder()
.addContactPoint(new InetSocketAddress("localhost", 9042))
.withKeyspace(CqlIdentifier.fromCql("links"))
.withLocalDatacenter("datacenter1")
.build();
And this is how I execute a query
JSONObject json = new JSONObject(linksRow);
JsonInsert query = insertInto("links").json(json.toString());
session.execute(query.toString());
Could you tell me what I'm doing wrong? The CqlSession should be thread-safe according to the documentation. (https://docs.datastax.com/en/developer/java-driver/4.0/manual/core/)
Edit: Added insert query