Skip to content

Commit

Permalink
Merge pull request #120 from yma96/master
Browse files Browse the repository at this point in the history
Fix Cassandra init issue when reconnect
  • Loading branch information
yma96 authored Nov 4, 2024
2 parents 7048b13 + 779586c commit 386c37b
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class CassandraPathDB

private PathMappedStorageConfig config;

private final String keyspace;
private String keyspace;

private int replicationFactor = 1; // keyspace replica, default 1

Expand Down Expand Up @@ -113,7 +113,11 @@ public CassandraPathDB( PathMappedStorageConfig config, Session session, String
public CassandraPathDB( PathMappedStorageConfig config )
{
this.config = config;
init();
}

public void init()
{
String host = (String) config.getProperty( CassandraPathDBUtils.PROP_CASSANDRA_HOST );
int port = (Integer) config.getProperty( CassandraPathDBUtils.PROP_CASSANDRA_PORT );
String username = (String) config.getProperty( CassandraPathDBUtils.PROP_CASSANDRA_USER );
Expand Down Expand Up @@ -973,7 +977,7 @@ private ResultSet executeSession ( BoundStatement bind )
if ( session == null || session.isClosed() )
{
close();
new CassandraPathDB( config );
this.init();
}
trackingRecord = session.execute( bind );
}
Expand All @@ -987,7 +991,7 @@ private ResultSet executeSession ( BoundStatement bind )
if ( exception )
{
close();
new CassandraPathDB( config );
this.init();
trackingRecord = session.execute( bind );
}
}
Expand Down

0 comments on commit 386c37b

Please sign in to comment.