Added exception handling around client creation
@@ -75,7 +75,7 @@ public class CassandraModule extends AbstractModule
bind(CassandraDatastore.class).in(Scopes.SINGLETON);
bind(CleanRowKeyCache.class).in(Scopes.SINGLETON);
bind(CassandraConfiguration.class).in(Scopes.SINGLETON);
- bind(CassandraClient.class).to(CassandraClientImpl.class);
+ //bind(CassandraClient.class).to(CassandraClientImpl.class);
bind(CassandraClientImpl.class).in(Scopes.SINGLETON);
bind(BatchStats.class).in(Scopes.SINGLETON);
@@ -102,11 +102,11 @@ public class CassandraModule extends AbstractModule
@Provides
@Singleton
- Schema getCassandraSchema(CassandraClient cassandraClient)
+ CassandraClient getCassandraClient(CassandraConfiguration configuration)
{
try
{
- return new Schema(cassandraClient);
+ return new CassandraClientImpl(configuration);
}
catch (Exception e)
{
@@ -115,6 +115,21 @@ public class CassandraModule extends AbstractModule
}
}
+ @Provides
+ @Singleton
+ Schema getCassandraSchema(CassandraClient cassandraClient)
+ {
+ try
+ {
+ return new Schema(cassandraClient);
+ }
+ catch (Exception e)
+ {
+ logger.error("Unable to setup cassandra schema", e);
+ throw new RuntimeException("Unable to setup cassandra schema");
+ }
+ }
+
@Provides
@Singleton
LoadBalancingPolicy getLoadBalancingPolicy(CassandraClient cassandraClient)
