in src/main/java/org/apache/fineract/cn/cassandra/core/CassandraSessionProvider.java [133:157]
public Session getSession(@Nonnull final String clusterName,
@Nonnull final String contactPoints,
@Nonnull final String keyspace) {
Assert.notNull(clusterName, "A cluster name must be given.");
Assert.hasText(clusterName, "A cluster name must be given.");
Assert.notNull(contactPoints, "At least one contact point must be given.");
Assert.hasText(contactPoints, "At least one contact point must be given.");
Assert.notNull(keyspace, "A keyspace must be given.");
Assert.hasText(keyspace, "A keyspace must be given.");
this.sessionCache.computeIfAbsent(keyspace, (sessionKey) -> {
this.logger.info("Create new session for keyspace [" + keyspace + "].");
final Cluster cluster = this.clusterCache.computeIfAbsent(clusterName,
(clusterKey) -> getCluster(clusterKey, contactPoints));
try {
CodecRegistry.apply(cluster);
return cluster.connect(keyspace);
} catch (final InvalidQueryException ex) {
throw new KeyspaceDoesntExistYet("Could not connect keyspace!", ex);
}
});
return this.sessionCache.get(keyspace);
}