Skip to content
Permalink
Browse files
cassandra host from system property
git-svn-id: https://svn.apache.org/repos/asf/archiva/sandbox/trunk@1491405 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
olamy committed Jun 10, 2013
1 parent 5660df0 commit 233d2e17f2f67dd149eec34d3b1d344ad2bbe3d3
Showing 1 changed file with 4 additions and 2 deletions.
@@ -37,6 +37,7 @@

/**
* FIXME make all configuration not hardcoded :-)
*
* @author Olivier Lamy
*/
@Service("archivaEntityManagerFactory#cassandra")
@@ -60,15 +61,16 @@
public void initialize()
throws ConnectionException
{
String cassandraHost = System.getProperty( "cassandraHost", "localhost" );
String cassandraPort = System.getProperty( "cassandraPort" );
keyspaceContext = new AstyanaxContext.Builder().forCluster( CLUSTER_NAME ).forKeyspace(
KEYSPACE_NAME ).withAstyanaxConfiguration(
new AstyanaxConfigurationImpl().setDiscoveryType( NodeDiscoveryType.RING_DESCRIBE ).setConnectionPoolType(
ConnectionPoolType.TOKEN_AWARE ) ).withConnectionPoolConfiguration(
new ConnectionPoolConfigurationImpl( CLUSTER_NAME + "_" + KEYSPACE_NAME ).setSocketTimeout(
30000 ).setMaxTimeoutWhenExhausted( 2000 ).setMaxConnsPerHost( 20 ).setInitConnsPerHost( 10 ).setSeeds(
"localhost:"+ cassandraPort ) ).withConnectionPoolMonitor( new CountingConnectionPoolMonitor() ).buildKeyspace(
ThriftFamilyFactory.getInstance() );
cassandraHost + ":" + cassandraPort ) ).withConnectionPoolMonitor(
new CountingConnectionPoolMonitor() ).buildKeyspace( ThriftFamilyFactory.getInstance() );

keyspaceContext.start();

0 comments on commit 233d2e1

Please sign in to comment.