]> source.dussan.org Git - archiva.git/commitdiff
Changing timeout parameter for cassandra driver
authorMartin Stockhammer <martin_s@apache.org>
Sun, 29 Aug 2021 10:11:06 +0000 (12:11 +0200)
committerMartin Stockhammer <martin_s@apache.org>
Sun, 29 Aug 2021 10:11:06 +0000 (12:11 +0200)
archiva-modules/metadata/metadata-store-provider/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/DefaultCassandraArchivaManager.java
archiva-modules/metadata/metadata-store-provider/metadata-store-cassandra/src/main/resources/default-archiva-cassandra.properties
archiva-modules/metadata/metadata-store-provider/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java

index 085f3e205f7c9b6c53e4a342352d3c0bd0834ecb..720f1a912f1926219c1360489f3aa8a5c43dd159 100644 (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( );
 
         {
index e55a955b8ac907acdb029c3f4e34c640fa8704d8..220e501a216d524a11927ab84f40691bb1c26b6e 100644 (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
\ No newline at end of file
index 491edc2f03ac2d8315b0e8fb069df558d1eec955..4ab388149369c656796acc08ab446d82e3352bf8 100644 (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 )