Changing timeout parameter for cassandra driver

This commit is contained in:
Martin Stockhammer 2021-08-29 12:11:06 +02:00
parent 699920cb89
commit 20918cb383
3 changed files with 10 additions and 6 deletions

View File

@ -129,6 +129,9 @@ public class DefaultCassandraArchivaManager
@Value( "${cassandra.maxActive}" )
private int maxActive;
@Value( "${cassandra.driverTimeoutMs}" )
private int driverTimeoutMs;
@Value( "${cassandra.readConsistencyLevel}" )
private String readConsistencyLevel;
@ -186,7 +189,7 @@ public class DefaultCassandraArchivaManager
.withInt( DefaultDriverOption.CONNECTION_POOL_REMOTE_SIZE, maxActive )
//.withInt( DefaultDriverOption.CONNECTION_MAX_REQUESTS, maxActive )
.withString( DefaultDriverOption.REQUEST_CONSISTENCY, readConsistencyLevel )
.withDuration( DefaultDriverOption.REQUEST_TIMEOUT, Duration.ofSeconds( 10 ) )
.withDuration( DefaultDriverOption.REQUEST_TIMEOUT, Duration.ofMillis( driverTimeoutMs ) )
.build( );
{

View File

@ -24,5 +24,6 @@ cassandra.writeConsistencyLevel=QUORUM
cassandra.replicationFactor=1
cassandra.keyspace.name=ArchivaKeySpace
cassandra.cluster.name=archiva
cassandra.driverTimeoutMs=20000
archiva.cassandra.configuration.file=./archiva-cassandra.properties

View File

@ -92,9 +92,9 @@ public class CassandraMetadataRepositoryTest
throws Exception
{
cTime = System.currentTimeMillis( );
System.err.println( "Setting up "+(testNum++) + " - " + testInfo.getDisplayName() );
System.err.println( "Setting up - "+(testNum++) + " - " + testInfo.getDisplayName() + " - 0ms");
super.setUp();
System.err.println( "Setting up 2 " + testInfo.getDisplayName( ) + " - " + (System.currentTimeMillis( ) - cTime) );
System.err.println( "Setting up - " + testInfo.getDisplayName( ) + " - " + (System.currentTimeMillis( ) - cTime) +"ms");
assertMaxTries =1;
assertRetrySleepMs=10;
@ -124,7 +124,7 @@ public class CassandraMetadataRepositoryTest
clearReposAndNamespace( cassandraArchivaManager );
clearedTables.set( true );
}
System.err.println( "Finished setting up "+testInfo.getDisplayName() + " - " + (System.currentTimeMillis( ) - cTime) );
System.err.println( "Finished setting up - "+testInfo.getDisplayName() + " - " + (System.currentTimeMillis( ) - cTime) +"ms");
}
/**
@ -163,11 +163,11 @@ public class CassandraMetadataRepositoryTest
public void shutdown(TestInfo testInfo)
throws Exception
{
System.err.println( "Shutting down " + testInfo.getDisplayName( ) + " - " + ( System.currentTimeMillis( ) - cTime ) );
System.err.println( "Shutting down - " + (testNum-1) + " - " + testInfo.getDisplayName( ) + " - " + ( System.currentTimeMillis( ) - cTime ) +"ms");
clearReposAndNamespace( cassandraArchivaManager );
clearedTables.set( true );
super.tearDown();
System.err.println( "Shutting down finished" + testInfo.getDisplayName( ) + " - " + ( System.currentTimeMillis( ) - cTime ) );
System.err.println( "Shutting down finished - " + testInfo.getDisplayName( ) + " - " + ( System.currentTimeMillis( ) - cTime ) +"ms");
}
static void clearReposAndNamespace( CassandraArchivaManager cassandraArchivaManager )