diff --git a/.baseline/checkstyle/checkstyle.xml b/.baseline/checkstyle/checkstyle.xml index 89f9c2c869f..494192ad906 100644 --- a/.baseline/checkstyle/checkstyle.xml +++ b/.baseline/checkstyle/checkstyle.xml @@ -405,7 +405,7 @@ - + diff --git a/atlasdb-cassandra/src/main/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraClientPoolingContainer.java b/atlasdb-cassandra/src/main/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraClientPoolingContainer.java index 82394922724..4209a11d6d3 100644 --- a/atlasdb-cassandra/src/main/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraClientPoolingContainer.java +++ b/atlasdb-cassandra/src/main/java/com/palantir/atlasdb/keyvalue/cassandra/CassandraClientPoolingContainer.java @@ -34,6 +34,7 @@ import java.lang.management.ThreadMXBean; import java.lang.reflect.Field; import java.net.InetSocketAddress; +import java.time.Duration; import java.time.Instant; import java.time.format.DateTimeFormatter; import java.util.NoSuchElementException; @@ -280,7 +281,7 @@ private GenericObjectPool createClientPool() { poolConfig.setTestOnBorrow(true); poolConfig.setSoftMinEvictableIdleTimeMillis( - TimeUnit.MILLISECONDS.convert(config.idleConnectionTimeoutSeconds(), TimeUnit.SECONDS)); + TimeUnit.MILLISECONDS.convert(Duration.ofSeconds(config.idleConnectionTimeoutSeconds()))); poolConfig.setMinEvictableIdleTimeMillis(Long.MAX_VALUE); // the randomness here is to prevent all of the pools for all of the hosts @@ -288,7 +289,7 @@ private GenericObjectPool createClientPool() { int timeBetweenEvictionsSeconds = config.timeBetweenConnectionEvictionRunsSeconds(); int delta = ThreadLocalRandom.current().nextInt(Math.min(timeBetweenEvictionsSeconds / 2, 10)); poolConfig.setTimeBetweenEvictionRunsMillis( - TimeUnit.MILLISECONDS.convert(timeBetweenEvictionsSeconds + delta, TimeUnit.SECONDS)); + TimeUnit.MILLISECONDS.convert(Duration.ofSeconds(timeBetweenEvictionsSeconds + delta))); poolConfig.setNumTestsPerEvictionRun(-(int) (1.0 / config.proportionConnectionsToCheckPerEvictionRun())); poolConfig.setTestWhileIdle(true); diff --git a/atlasdb-ete-tests/src/test/java/com/palantir/atlasdb/ete/TimeLockMigrationEteTest.java b/atlasdb-ete-tests/src/test/java/com/palantir/atlasdb/ete/TimeLockMigrationEteTest.java index c2cb9d38d60..78d3ac3c728 100644 --- a/atlasdb-ete-tests/src/test/java/com/palantir/atlasdb/ete/TimeLockMigrationEteTest.java +++ b/atlasdb-ete-tests/src/test/java/com/palantir/atlasdb/ete/TimeLockMigrationEteTest.java @@ -34,7 +34,6 @@ import java.time.Duration; import java.util.Optional; import java.util.concurrent.Callable; -import java.util.concurrent.TimeUnit; import org.assertj.core.api.JUnitSoftAssertions; import org.awaitility.Awaitility; import org.immutables.value.Value; @@ -184,7 +183,7 @@ private void downgradeAtlasClientFromTimelockWithoutMigration() { // TODO (jkong): Be better. // Realistically, this is enough time for the server to start up, and we value the test signal here // if we're going to be doing these migrations... - Uninterruptibles.sleepUninterruptibly(30, TimeUnit.SECONDS); + Uninterruptibles.sleepUninterruptibly(Duration.ofSeconds(30)); } } diff --git a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/sweep/priority/SweepPriorityCalculator.java b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/sweep/priority/SweepPriorityCalculator.java index 7b6cae1153f..38e6c0da4ea 100644 --- a/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/sweep/priority/SweepPriorityCalculator.java +++ b/atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/sweep/priority/SweepPriorityCalculator.java @@ -52,7 +52,7 @@ class SweepPriorityCalculator { // weights one month of no sweeping with the same priority as about 100000 expected cells to sweep. private static final double MILLIS_SINCE_SWEEP_PRIORITY_WEIGHT = - 100_000.0 / TimeUnit.MILLISECONDS.convert(30, TimeUnit.DAYS); + 100_000.0 / TimeUnit.MILLISECONDS.convert(Duration.ofDays(30)); private final KeyValueService kvs; private final SweepPriorityStore sweepPriorityStore; @@ -234,13 +234,13 @@ private boolean tooFewWritesToBother(long writeCount, long cellTsPairsExamined, // for large tables we're essentially just comparing writeCount <= cellTsPairsExamined / 100 boolean fewWrites = writeCount <= 100 + cellTsPairsExamined / 100; - long daysSinceLastSweep = TimeUnit.DAYS.convert(millisSinceSweep, TimeUnit.MILLISECONDS); + long daysSinceLastSweep = TimeUnit.DAYS.convert(Duration.ofMillis(millisSinceSweep)); return fewWrites && daysSinceLastSweep < 180; } private boolean weWantToAvoidOverloadingTheStoreWithTombstones(SweepPriority newPriority, long millisSinceSweep) { - long daysSinceLastSweep = TimeUnit.DAYS.convert(millisSinceSweep, TimeUnit.MILLISECONDS); + long daysSinceLastSweep = TimeUnit.DAYS.convert(Duration.ofMillis(millisSinceSweep)); return newPriority.staleValuesDeleted() > WAIT_BEFORE_SWEEPING_IF_WE_GENERATE_THIS_MANY_TOMBSTONES && daysSinceLastSweep < 1 diff --git a/build.gradle b/build.gradle index 1734ef1f37e..870a0db732c 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ buildscript { classpath 'com.netflix.nebula:gradle-info-plugin:9.3.0' classpath 'com.netflix.nebula:nebula-publishing-plugin:17.3.2' classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.2.1' - classpath 'com.palantir.baseline:gradle-baseline-java:3.87.0' + classpath 'com.palantir.baseline:gradle-baseline-java:3.92.0' classpath 'com.palantir.gradle.conjure:gradle-conjure:5.10.0' classpath 'com.palantir.javaformat:gradle-palantir-java-format:1.0.1' classpath 'com.palantir.metricschema:gradle-metric-schema:0.6.0'