From f16e10cb828efb50f4007bcc7d6d9957f44adc9f Mon Sep 17 00:00:00 2001 From: Thiago Cesar Jasper Moreira Date: Tue, 12 Dec 2023 11:13:14 +0000 Subject: [PATCH 1/3] Modernize dependencies and format --- .../elasticache/ElastiCacheResolver.java | 4 +-- folsom-micrometer-metrics/pom.xml | 2 +- .../folsom/client/MicrometerMetrics.java | 4 ++- folsom-opencensus/pom.xml | 2 +- .../folsom/opencensus/OpenCensusSpanTest.java | 6 ++-- .../folsom/opencensus/OpenCensusTest.java | 3 +- folsom-opentelemetry-metrics/pom.xml | 4 +-- .../folsom/client/OpenTelemetryMetrics.java | 3 +- .../client/OpenTelemetryMetricsTest.java | 8 ++--- folsom/pom.xml | 24 ++++++------- .../spotify/folsom/MemcacheClientBuilder.java | 22 +++++++----- .../com/spotify/folsom/ObservableClient.java | 16 ++++++--- .../java/com/spotify/folsom/SrvResolver.java | 4 +-- .../com/spotify/folsom/client/AllRequest.java | 3 +- .../ascii/DefaultAsciiMemcacheClient.java | 5 +-- .../binary/DefaultBinaryMemcacheClient.java | 5 +-- .../folsom/ketama/KetamaMemcacheClient.java | 3 +- .../folsom/ketama/ResolvingKetamaClient.java | 10 ++---- .../SerializableObjectTranscoder.java | 2 +- .../folsom/ResolveKetamaIntegrationTest.java | 3 +- .../reconnect/ReconnectingClientTest.java | 4 +-- pom.xml | 35 ++++++++++--------- 22 files changed, 84 insertions(+), 88 deletions(-) diff --git a/folsom-elasticache/src/main/java/com/spotify/folsom/elasticache/ElastiCacheResolver.java b/folsom-elasticache/src/main/java/com/spotify/folsom/elasticache/ElastiCacheResolver.java index ceff37da..a7253636 100644 --- a/folsom-elasticache/src/main/java/com/spotify/folsom/elasticache/ElastiCacheResolver.java +++ b/folsom-elasticache/src/main/java/com/spotify/folsom/elasticache/ElastiCacheResolver.java @@ -145,9 +145,7 @@ public List resolve() { } }); - return effective - .getHosts() - .stream() + return effective.getHosts().stream() .map(hap -> new ResolveResult(hap.getHostText(), hap.getPort(), ttl)) .collect(toList()); } diff --git a/folsom-micrometer-metrics/pom.xml b/folsom-micrometer-metrics/pom.xml index 941cb01f..095ff4b1 100644 --- a/folsom-micrometer-metrics/pom.xml +++ b/folsom-micrometer-metrics/pom.xml @@ -19,7 +19,7 @@ io.micrometer micrometer-core - 1.10.3 + 1.12.0 diff --git a/folsom-micrometer-metrics/src/main/java/com/spotify/folsom/client/MicrometerMetrics.java b/folsom-micrometer-metrics/src/main/java/com/spotify/folsom/client/MicrometerMetrics.java index c6ba34b4..1e31f103 100644 --- a/folsom-micrometer-metrics/src/main/java/com/spotify/folsom/client/MicrometerMetrics.java +++ b/folsom-micrometer-metrics/src/main/java/com/spotify/folsom/client/MicrometerMetrics.java @@ -56,7 +56,9 @@ public class MicrometerMetrics implements Metrics { private final Set gauges = new CopyOnWriteArraySet<>(); - /** @param registry MeterRegistry */ + /** + * @param registry MeterRegistry + */ public MicrometerMetrics(final MeterRegistry registry) { this(registry, Tags.empty()); } diff --git a/folsom-opencensus/pom.xml b/folsom-opencensus/pom.xml index eefb9984..b2f8c03a 100644 --- a/folsom-opencensus/pom.xml +++ b/folsom-opencensus/pom.xml @@ -45,7 +45,7 @@ org.hamcrest hamcrest - 2.1 + 2.2 test diff --git a/folsom-opencensus/src/test/java/com/spotify/folsom/opencensus/OpenCensusSpanTest.java b/folsom-opencensus/src/test/java/com/spotify/folsom/opencensus/OpenCensusSpanTest.java index 4da1e755..41cd4aa3 100644 --- a/folsom-opencensus/src/test/java/com/spotify/folsom/opencensus/OpenCensusSpanTest.java +++ b/folsom-opencensus/src/test/java/com/spotify/folsom/opencensus/OpenCensusSpanTest.java @@ -20,7 +20,7 @@ import static io.opencensus.trace.AttributeValue.stringAttributeValue; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import com.google.common.io.BaseEncoding; import com.spotify.folsom.Span; @@ -29,7 +29,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class OpenCensusSpanTest { @@ -82,6 +82,6 @@ public void nullValue() { final Span span = new OpenCensusSpan(wrapped, true); span.value(null); - verifyZeroInteractions(wrapped); + verifyNoInteractions(wrapped); } } diff --git a/folsom-opencensus/src/test/java/com/spotify/folsom/opencensus/OpenCensusTest.java b/folsom-opencensus/src/test/java/com/spotify/folsom/opencensus/OpenCensusTest.java index f7ffe55a..ac3ced91 100644 --- a/folsom-opencensus/src/test/java/com/spotify/folsom/opencensus/OpenCensusTest.java +++ b/folsom-opencensus/src/test/java/com/spotify/folsom/opencensus/OpenCensusTest.java @@ -175,8 +175,7 @@ public void describeTo(final Description description) { } private List getByParent(final List spans, final SpanData parent) { - return spans - .stream() + return spans.stream() .filter(data -> parent.getContext().getSpanId().equals(data.getParentSpanId())) .collect(Collectors.toList()); } diff --git a/folsom-opentelemetry-metrics/pom.xml b/folsom-opentelemetry-metrics/pom.xml index 6bca1695..82b3adf1 100644 --- a/folsom-opentelemetry-metrics/pom.xml +++ b/folsom-opentelemetry-metrics/pom.xml @@ -19,12 +19,12 @@ io.opentelemetry opentelemetry-api - 1.29.0 + 1.33.0 io.opentelemetry opentelemetry-sdk-testing - 1.29.0 + 1.33.0 test diff --git a/folsom-opentelemetry-metrics/src/main/java/com/spotify/folsom/client/OpenTelemetryMetrics.java b/folsom-opentelemetry-metrics/src/main/java/com/spotify/folsom/client/OpenTelemetryMetrics.java index 3c50ac82..560ae6c1 100644 --- a/folsom-opentelemetry-metrics/src/main/java/com/spotify/folsom/client/OpenTelemetryMetrics.java +++ b/folsom-opentelemetry-metrics/src/main/java/com/spotify/folsom/client/OpenTelemetryMetrics.java @@ -85,8 +85,7 @@ public OpenTelemetryMetrics(final OpenTelemetry openTelemetry) { private void outstandingRequestsObservable(final ObservableDoubleMeasurement measurement) { measurement.record( - outstandingRequests - .stream() + outstandingRequests.stream() .mapToLong(value -> (long) value.getOutstandingRequests()) .sum()); } diff --git a/folsom-opentelemetry-metrics/src/test/java/com/spotify/folsom/client/OpenTelemetryMetricsTest.java b/folsom-opentelemetry-metrics/src/test/java/com/spotify/folsom/client/OpenTelemetryMetricsTest.java index 11d39181..0e466cb5 100644 --- a/folsom-opentelemetry-metrics/src/test/java/com/spotify/folsom/client/OpenTelemetryMetricsTest.java +++ b/folsom-opentelemetry-metrics/src/test/java/com/spotify/folsom/client/OpenTelemetryMetricsTest.java @@ -618,9 +618,7 @@ public void shouldRegisterGaugesWithoutRaceCondition() throws InterruptedExcepti } private GaugeData getGaugeByName(String gaugeName) { - return otelTesting - .getMetrics() - .stream() + return otelTesting.getMetrics().stream() .filter(metricData -> Objects.equals(gaugeName, metricData.getName())) .findFirst() .orElseThrow(() -> new RuntimeException("gauge not found")) @@ -630,9 +628,7 @@ private GaugeData getGaugeByName(String gaugeName) { private T findMetric( String metricName, String key, String value, Class targetClass) { PointData pointData = - otelTesting - .getMetrics() - .stream() + otelTesting.getMetrics().stream() .filter(metricData -> Objects.equals(metricName, metricData.getName())) .findFirst() .orElseThrow(() -> new RuntimeException("metric not found")) diff --git a/folsom/pom.xml b/folsom/pom.xml index 6ae2de76..d8f7842f 100644 --- a/folsom/pom.xml +++ b/folsom/pom.xml @@ -13,24 +13,24 @@ folsom - 4.1.87.Final + 4.1.101.Final com.spotify completable-futures - 0.3.2 + 0.3.5 com.google.guava guava - 30.1.1-android + 32.1.3-android org.slf4j slf4j-api - 1.7.36 + 2.0.9 io.netty @@ -53,9 +53,9 @@ 3.1.5 - commons-lang - commons-lang - 2.6 + org.apache.commons + commons-lang3 + 3.14.0 @@ -67,7 +67,7 @@ ch.qos.logback logback-classic - 1.2.3 + 1.4.14 test @@ -95,20 +95,20 @@ org.hamcrest - hamcrest-library - 1.3 + hamcrest + 2.2 test com.spotify hamcrest-future - 1.0.1 + 1.3.2 test org.jmock jmock - 2.6.0 + 2.12.0 test diff --git a/folsom/src/main/java/com/spotify/folsom/MemcacheClientBuilder.java b/folsom/src/main/java/com/spotify/folsom/MemcacheClientBuilder.java index 6f74ef4f..dba6adc6 100644 --- a/folsom/src/main/java/com/spotify/folsom/MemcacheClientBuilder.java +++ b/folsom/src/main/java/com/spotify/folsom/MemcacheClientBuilder.java @@ -237,7 +237,9 @@ private void updateResolver() { } } - /** @deprecated Use {@link #withResolver(Resolver)} with {@link SrvResolver} instead. */ + /** + * @deprecated Use {@link #withResolver(Resolver)} with {@link SrvResolver} instead. + */ @Deprecated public MemcacheClientBuilder withSRVRecord(final String srvRecord) { this.srvRecord = requireNonNull(srvRecord); @@ -257,7 +259,9 @@ public MemcacheClientBuilder withResolveRefreshPeriod(final long periodMillis return this; } - /** @deprecated Use {@link #withResolveRefreshPeriod(long)} */ + /** + * @deprecated Use {@link #withResolveRefreshPeriod(long)} + */ @Deprecated public MemcacheClientBuilder withSRVRefreshPeriod(final long periodMillis) { return withResolveRefreshPeriod(periodMillis); @@ -275,13 +279,17 @@ public MemcacheClientBuilder withResolveShutdownDelay(final long shutdownDela return this; } - /** @deprecated Use {@link #withResolveShutdownDelay(long)} */ + /** + * @deprecated Use {@link #withResolveShutdownDelay(long)} + */ @Deprecated public MemcacheClientBuilder withSRVShutdownDelay(final long shutdownDelay) { return withResolveShutdownDelay(shutdownDelay); } - /** @deprecated Use {@link #withResolver(Resolver)} with {@link SrvResolver} instead */ + /** + * @deprecated Use {@link #withResolver(Resolver)} with {@link SrvResolver} instead + */ @Deprecated public MemcacheClientBuilder withSrvResolver(final DnsSrvResolver srvResolver) { this.srvResolver = requireNonNull(srvResolver, "srvResolver"); @@ -606,15 +614,13 @@ private Authenticator getAuthenticator(Authenticator defaultValue) { if (defaultValue instanceof BinaryAuthenticationValidator) { List authenticatorList = - passwords - .stream() + passwords.stream() .map(UsernamePasswordPair::getPlainTextAuthenticator) .collect(Collectors.toList()); return new MultiAuthenticator(authenticatorList); } else if (defaultValue instanceof AsciiAuthenticationValidator) { List authenticatorList = - passwords - .stream() + passwords.stream() .map(UsernamePasswordPair::getAsciiAuthenticator) .collect(Collectors.toList()); return new MultiAuthenticator(authenticatorList); diff --git a/folsom/src/main/java/com/spotify/folsom/ObservableClient.java b/folsom/src/main/java/com/spotify/folsom/ObservableClient.java index 09468c29..b1e17c6e 100644 --- a/folsom/src/main/java/com/spotify/folsom/ObservableClient.java +++ b/folsom/src/main/java/com/spotify/folsom/ObservableClient.java @@ -50,22 +50,30 @@ public interface ObservableClient { */ boolean isConnected(); - /** @return completes when at least one underlying client is connected */ + /** + * @return completes when at least one underlying client is connected + */ default CompletionStage connectFuture() { return ConnectFuture.connectFuture(this); } - /** @return completes when at least one underlying client is disconnected */ + /** + * @return completes when at least one underlying client is disconnected + */ default CompletionStage disconnectFuture() { return ConnectFuture.disconnectFuture(this); } - /** @return completes when all underlying clients are connected */ + /** + * @return completes when all underlying clients are connected + */ default CompletionStage fullyConnectedFuture() { return ConnectFuture.fullyConnectedFuture(this); } - /** @return completes when all underlying clients are disconnected */ + /** + * @return completes when all underlying clients are disconnected + */ default CompletionStage fullyDisconnectFuture() { return ConnectFuture.fullyDisconnectedFuture(this); } diff --git a/folsom/src/main/java/com/spotify/folsom/SrvResolver.java b/folsom/src/main/java/com/spotify/folsom/SrvResolver.java index cd238370..f22014d0 100644 --- a/folsom/src/main/java/com/spotify/folsom/SrvResolver.java +++ b/folsom/src/main/java/com/spotify/folsom/SrvResolver.java @@ -80,9 +80,7 @@ private SrvResolver(final DnsSrvResolver dnsSrvResolver, final String srvRecord) @Override public List resolve() { - return dnsSrvResolver - .resolve(srvRecord) - .stream() + return dnsSrvResolver.resolve(srvRecord).stream() .map(result -> new ResolveResult(result.host(), result.port(), result.ttl())) .collect(Collectors.toList()); } diff --git a/folsom/src/main/java/com/spotify/folsom/client/AllRequest.java b/folsom/src/main/java/com/spotify/folsom/client/AllRequest.java index 245a2450..a6976457 100644 --- a/folsom/src/main/java/com/spotify/folsom/client/AllRequest.java +++ b/folsom/src/main/java/com/spotify/folsom/client/AllRequest.java @@ -31,8 +31,7 @@ default CompletionStage preMerge(CompletionStage stage) { T merge(List results); static MemcacheStatus mergeMemcacheStatus(final List results) { - return results - .stream() + return results.stream() .filter(status -> status != MemcacheStatus.OK) .findFirst() .orElse(MemcacheStatus.OK); diff --git a/folsom/src/main/java/com/spotify/folsom/client/ascii/DefaultAsciiMemcacheClient.java b/folsom/src/main/java/com/spotify/folsom/client/ascii/DefaultAsciiMemcacheClient.java index 3b6fe76f..27cdfc1d 100644 --- a/folsom/src/main/java/com/spotify/folsom/client/ascii/DefaultAsciiMemcacheClient.java +++ b/folsom/src/main/java/com/spotify/folsom/client/ascii/DefaultAsciiMemcacheClient.java @@ -379,10 +379,7 @@ public RawMemcacheClient getRawMemcacheClient() { @Override public Map> getAllNodes() { - return rawMemcacheClient - .getAllNodes() - .entrySet() - .stream() + return rawMemcacheClient.getAllNodes().entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, entry -> withClient(entry.getValue()))); } diff --git a/folsom/src/main/java/com/spotify/folsom/client/binary/DefaultBinaryMemcacheClient.java b/folsom/src/main/java/com/spotify/folsom/client/binary/DefaultBinaryMemcacheClient.java index 5d8a0fdc..ecab07ee 100644 --- a/folsom/src/main/java/com/spotify/folsom/client/binary/DefaultBinaryMemcacheClient.java +++ b/folsom/src/main/java/com/spotify/folsom/client/binary/DefaultBinaryMemcacheClient.java @@ -470,10 +470,7 @@ public RawMemcacheClient getRawMemcacheClient() { @Override public Map> getAllNodes() { - return rawMemcacheClient - .getAllNodes() - .entrySet() - .stream() + return rawMemcacheClient.getAllNodes().entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, entry -> withClient(entry.getValue()))); } diff --git a/folsom/src/main/java/com/spotify/folsom/ketama/KetamaMemcacheClient.java b/folsom/src/main/java/com/spotify/folsom/ketama/KetamaMemcacheClient.java index ebf88c5d..c1729b65 100644 --- a/folsom/src/main/java/com/spotify/folsom/ketama/KetamaMemcacheClient.java +++ b/folsom/src/main/java/com/spotify/folsom/ketama/KetamaMemcacheClient.java @@ -80,8 +80,7 @@ public CompletionStage send(final Request request) { private CompletionStage sendToAll(final AllRequest request) { final List> futures = - clients - .stream() + clients.stream() .map(client -> client.send(request.duplicate())) .map(request::preMerge) .collect(Collectors.toList()); diff --git a/folsom/src/main/java/com/spotify/folsom/ketama/ResolvingKetamaClient.java b/folsom/src/main/java/com/spotify/folsom/ketama/ResolvingKetamaClient.java index 46dfb0c7..b1e66409 100644 --- a/folsom/src/main/java/com/spotify/folsom/ketama/ResolvingKetamaClient.java +++ b/folsom/src/main/java/com/spotify/folsom/ketama/ResolvingKetamaClient.java @@ -103,14 +103,12 @@ public void resolve() { } final Set newAddresses = - lookupResults - .stream() + lookupResults.stream() .map(result -> HostAndPort.fromParts(result.getHost(), result.getPort())) .collect(Collectors.toSet()); final long resolvedTtl = - lookupResults - .stream() + lookupResults.stream() .mapToLong(Resolver.ResolveResult::getTtl) .min() .orElse(Long.MAX_VALUE); @@ -208,9 +206,7 @@ private void setPendingClient(final ImmutableList.Builder rem shutdownQueue.addAll(removedClients.build()); final List addressAndClients = - clients - .entrySet() - .stream() + clients.entrySet().stream() .map(e -> new AddressAndClient(e.getKey(), e.getValue())) .collect(Collectors.toList()); diff --git a/folsom/src/main/java/com/spotify/folsom/transcoder/SerializableObjectTranscoder.java b/folsom/src/main/java/com/spotify/folsom/transcoder/SerializableObjectTranscoder.java index 686d207e..98365b03 100644 --- a/folsom/src/main/java/com/spotify/folsom/transcoder/SerializableObjectTranscoder.java +++ b/folsom/src/main/java/com/spotify/folsom/transcoder/SerializableObjectTranscoder.java @@ -18,7 +18,7 @@ import com.spotify.folsom.Transcoder; import java.io.Serializable; -import org.apache.commons.lang.SerializationUtils; +import org.apache.commons.lang3.SerializationUtils; public final class SerializableObjectTranscoder implements Transcoder { diff --git a/folsom/src/test/java/com/spotify/folsom/ResolveKetamaIntegrationTest.java b/folsom/src/test/java/com/spotify/folsom/ResolveKetamaIntegrationTest.java index 498da5cc..7b6d10db 100644 --- a/folsom/src/test/java/com/spotify/folsom/ResolveKetamaIntegrationTest.java +++ b/folsom/src/test/java/com/spotify/folsom/ResolveKetamaIntegrationTest.java @@ -60,8 +60,7 @@ public void setUp() throws Exception { } public static List toResult(List servers) { - return servers - .stream() + return servers.stream() .map(server -> LookupResult.create(server.getHost(), server.getPort(), 100, 100, 100)) .collect(Collectors.toList()); } diff --git a/folsom/src/test/java/com/spotify/folsom/reconnect/ReconnectingClientTest.java b/folsom/src/test/java/com/spotify/folsom/reconnect/ReconnectingClientTest.java index 4d6c3857..da1db271 100644 --- a/folsom/src/test/java/com/spotify/folsom/reconnect/ReconnectingClientTest.java +++ b/folsom/src/test/java/com/spotify/folsom/reconnect/ReconnectingClientTest.java @@ -45,7 +45,7 @@ import java.util.concurrent.TimeoutException; import org.junit.Before; import org.junit.Test; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.mockito.stubbing.Answer; @@ -57,7 +57,7 @@ public class ReconnectingClientTest { @Before public void setUp() throws Exception { when(scheduledExecutorService.schedule( - Mockito.any(), anyLong(), Matchers.any())) + Mockito.any(), anyLong(), ArgumentMatchers.any())) .thenAnswer( (Answer) invocationOnMock -> { diff --git a/pom.xml b/pom.xml index 559ced5c..8de93a85 100644 --- a/pom.xml +++ b/pom.xml @@ -80,22 +80,22 @@ com.spotify.metrics semantic-metrics-core - 1.0.2 + 1.2.0 junit junit - 4.13.1 + 4.13.2 org.mockito mockito-core - 3.11.2 + 4.11.0 org.testcontainers testcontainers - 1.16.3 + 1.19.3 @@ -115,7 +115,7 @@ org.apache.maven.plugins maven-compiler-plugin - 2.5.1 + 3.11.0 1.8 1.8 @@ -124,7 +124,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2 + 3.3.0 attach-sources @@ -137,7 +137,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.0.0-M1 + 3.6.3 private @@ -153,15 +153,15 @@ org.eluder.coveralls coveralls-maven-plugin - 3.0.1 + 4.3.0 ${coveralls.token} - com.coveo - fmt-maven-plugin - 2.5.1 + com.spotify.fmt + fmt-maven-plugin + 2.21.1 @@ -176,7 +176,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.3 + 1.6.13 true ossrh @@ -185,15 +185,18 @@ - com.coveo + com.spotify.fmt fmt-maven-plugin org.gaul modernizer-maven-plugin - 1.8.0 + 2.7.0 1.8 + + com.spotify.folsom.client.Utils.* + @@ -210,7 +213,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M2 + 3.4.1 enforce-java @@ -234,7 +237,7 @@ org.codehaus.mojo versions-maven-plugin - 2.5 + 2.16.2 true From 23bd5052c0a16a6b3c0a3cc3d19d2137b3c3375b Mon Sep 17 00:00:00 2001 From: Thiago Cesar Jasper Moreira Date: Tue, 12 Dec 2023 11:23:20 +0000 Subject: [PATCH 2/3] Modernize dependencies and format --- .../elasticache/ElastiCacheResolver.java | 4 +++- .../folsom/client/MicrometerMetrics.java | 4 +--- .../folsom/opencensus/OpenCensusTest.java | 3 ++- .../folsom/client/OpenTelemetryMetrics.java | 3 ++- .../client/OpenTelemetryMetricsTest.java | 8 +++++-- .../spotify/folsom/MemcacheClientBuilder.java | 22 +++++++------------ .../com/spotify/folsom/ObservableClient.java | 16 ++++---------- .../java/com/spotify/folsom/SrvResolver.java | 4 +++- .../com/spotify/folsom/client/AllRequest.java | 3 ++- .../ascii/DefaultAsciiMemcacheClient.java | 5 ++++- .../binary/DefaultBinaryMemcacheClient.java | 5 ++++- .../folsom/ketama/KetamaMemcacheClient.java | 3 ++- .../folsom/ketama/ResolvingKetamaClient.java | 10 ++++++--- .../folsom/ResolveKetamaIntegrationTest.java | 3 ++- pom.xml | 6 ++--- 15 files changed, 53 insertions(+), 46 deletions(-) diff --git a/folsom-elasticache/src/main/java/com/spotify/folsom/elasticache/ElastiCacheResolver.java b/folsom-elasticache/src/main/java/com/spotify/folsom/elasticache/ElastiCacheResolver.java index a7253636..ceff37da 100644 --- a/folsom-elasticache/src/main/java/com/spotify/folsom/elasticache/ElastiCacheResolver.java +++ b/folsom-elasticache/src/main/java/com/spotify/folsom/elasticache/ElastiCacheResolver.java @@ -145,7 +145,9 @@ public List resolve() { } }); - return effective.getHosts().stream() + return effective + .getHosts() + .stream() .map(hap -> new ResolveResult(hap.getHostText(), hap.getPort(), ttl)) .collect(toList()); } diff --git a/folsom-micrometer-metrics/src/main/java/com/spotify/folsom/client/MicrometerMetrics.java b/folsom-micrometer-metrics/src/main/java/com/spotify/folsom/client/MicrometerMetrics.java index 1e31f103..c6ba34b4 100644 --- a/folsom-micrometer-metrics/src/main/java/com/spotify/folsom/client/MicrometerMetrics.java +++ b/folsom-micrometer-metrics/src/main/java/com/spotify/folsom/client/MicrometerMetrics.java @@ -56,9 +56,7 @@ public class MicrometerMetrics implements Metrics { private final Set gauges = new CopyOnWriteArraySet<>(); - /** - * @param registry MeterRegistry - */ + /** @param registry MeterRegistry */ public MicrometerMetrics(final MeterRegistry registry) { this(registry, Tags.empty()); } diff --git a/folsom-opencensus/src/test/java/com/spotify/folsom/opencensus/OpenCensusTest.java b/folsom-opencensus/src/test/java/com/spotify/folsom/opencensus/OpenCensusTest.java index ac3ced91..f7ffe55a 100644 --- a/folsom-opencensus/src/test/java/com/spotify/folsom/opencensus/OpenCensusTest.java +++ b/folsom-opencensus/src/test/java/com/spotify/folsom/opencensus/OpenCensusTest.java @@ -175,7 +175,8 @@ public void describeTo(final Description description) { } private List getByParent(final List spans, final SpanData parent) { - return spans.stream() + return spans + .stream() .filter(data -> parent.getContext().getSpanId().equals(data.getParentSpanId())) .collect(Collectors.toList()); } diff --git a/folsom-opentelemetry-metrics/src/main/java/com/spotify/folsom/client/OpenTelemetryMetrics.java b/folsom-opentelemetry-metrics/src/main/java/com/spotify/folsom/client/OpenTelemetryMetrics.java index 560ae6c1..3c50ac82 100644 --- a/folsom-opentelemetry-metrics/src/main/java/com/spotify/folsom/client/OpenTelemetryMetrics.java +++ b/folsom-opentelemetry-metrics/src/main/java/com/spotify/folsom/client/OpenTelemetryMetrics.java @@ -85,7 +85,8 @@ public OpenTelemetryMetrics(final OpenTelemetry openTelemetry) { private void outstandingRequestsObservable(final ObservableDoubleMeasurement measurement) { measurement.record( - outstandingRequests.stream() + outstandingRequests + .stream() .mapToLong(value -> (long) value.getOutstandingRequests()) .sum()); } diff --git a/folsom-opentelemetry-metrics/src/test/java/com/spotify/folsom/client/OpenTelemetryMetricsTest.java b/folsom-opentelemetry-metrics/src/test/java/com/spotify/folsom/client/OpenTelemetryMetricsTest.java index 0e466cb5..11d39181 100644 --- a/folsom-opentelemetry-metrics/src/test/java/com/spotify/folsom/client/OpenTelemetryMetricsTest.java +++ b/folsom-opentelemetry-metrics/src/test/java/com/spotify/folsom/client/OpenTelemetryMetricsTest.java @@ -618,7 +618,9 @@ public void shouldRegisterGaugesWithoutRaceCondition() throws InterruptedExcepti } private GaugeData getGaugeByName(String gaugeName) { - return otelTesting.getMetrics().stream() + return otelTesting + .getMetrics() + .stream() .filter(metricData -> Objects.equals(gaugeName, metricData.getName())) .findFirst() .orElseThrow(() -> new RuntimeException("gauge not found")) @@ -628,7 +630,9 @@ private GaugeData getGaugeByName(String gaugeName) { private T findMetric( String metricName, String key, String value, Class targetClass) { PointData pointData = - otelTesting.getMetrics().stream() + otelTesting + .getMetrics() + .stream() .filter(metricData -> Objects.equals(metricName, metricData.getName())) .findFirst() .orElseThrow(() -> new RuntimeException("metric not found")) diff --git a/folsom/src/main/java/com/spotify/folsom/MemcacheClientBuilder.java b/folsom/src/main/java/com/spotify/folsom/MemcacheClientBuilder.java index dba6adc6..6f74ef4f 100644 --- a/folsom/src/main/java/com/spotify/folsom/MemcacheClientBuilder.java +++ b/folsom/src/main/java/com/spotify/folsom/MemcacheClientBuilder.java @@ -237,9 +237,7 @@ private void updateResolver() { } } - /** - * @deprecated Use {@link #withResolver(Resolver)} with {@link SrvResolver} instead. - */ + /** @deprecated Use {@link #withResolver(Resolver)} with {@link SrvResolver} instead. */ @Deprecated public MemcacheClientBuilder withSRVRecord(final String srvRecord) { this.srvRecord = requireNonNull(srvRecord); @@ -259,9 +257,7 @@ public MemcacheClientBuilder withResolveRefreshPeriod(final long periodMillis return this; } - /** - * @deprecated Use {@link #withResolveRefreshPeriod(long)} - */ + /** @deprecated Use {@link #withResolveRefreshPeriod(long)} */ @Deprecated public MemcacheClientBuilder withSRVRefreshPeriod(final long periodMillis) { return withResolveRefreshPeriod(periodMillis); @@ -279,17 +275,13 @@ public MemcacheClientBuilder withResolveShutdownDelay(final long shutdownDela return this; } - /** - * @deprecated Use {@link #withResolveShutdownDelay(long)} - */ + /** @deprecated Use {@link #withResolveShutdownDelay(long)} */ @Deprecated public MemcacheClientBuilder withSRVShutdownDelay(final long shutdownDelay) { return withResolveShutdownDelay(shutdownDelay); } - /** - * @deprecated Use {@link #withResolver(Resolver)} with {@link SrvResolver} instead - */ + /** @deprecated Use {@link #withResolver(Resolver)} with {@link SrvResolver} instead */ @Deprecated public MemcacheClientBuilder withSrvResolver(final DnsSrvResolver srvResolver) { this.srvResolver = requireNonNull(srvResolver, "srvResolver"); @@ -614,13 +606,15 @@ private Authenticator getAuthenticator(Authenticator defaultValue) { if (defaultValue instanceof BinaryAuthenticationValidator) { List authenticatorList = - passwords.stream() + passwords + .stream() .map(UsernamePasswordPair::getPlainTextAuthenticator) .collect(Collectors.toList()); return new MultiAuthenticator(authenticatorList); } else if (defaultValue instanceof AsciiAuthenticationValidator) { List authenticatorList = - passwords.stream() + passwords + .stream() .map(UsernamePasswordPair::getAsciiAuthenticator) .collect(Collectors.toList()); return new MultiAuthenticator(authenticatorList); diff --git a/folsom/src/main/java/com/spotify/folsom/ObservableClient.java b/folsom/src/main/java/com/spotify/folsom/ObservableClient.java index b1e17c6e..09468c29 100644 --- a/folsom/src/main/java/com/spotify/folsom/ObservableClient.java +++ b/folsom/src/main/java/com/spotify/folsom/ObservableClient.java @@ -50,30 +50,22 @@ public interface ObservableClient { */ boolean isConnected(); - /** - * @return completes when at least one underlying client is connected - */ + /** @return completes when at least one underlying client is connected */ default CompletionStage connectFuture() { return ConnectFuture.connectFuture(this); } - /** - * @return completes when at least one underlying client is disconnected - */ + /** @return completes when at least one underlying client is disconnected */ default CompletionStage disconnectFuture() { return ConnectFuture.disconnectFuture(this); } - /** - * @return completes when all underlying clients are connected - */ + /** @return completes when all underlying clients are connected */ default CompletionStage fullyConnectedFuture() { return ConnectFuture.fullyConnectedFuture(this); } - /** - * @return completes when all underlying clients are disconnected - */ + /** @return completes when all underlying clients are disconnected */ default CompletionStage fullyDisconnectFuture() { return ConnectFuture.fullyDisconnectedFuture(this); } diff --git a/folsom/src/main/java/com/spotify/folsom/SrvResolver.java b/folsom/src/main/java/com/spotify/folsom/SrvResolver.java index f22014d0..cd238370 100644 --- a/folsom/src/main/java/com/spotify/folsom/SrvResolver.java +++ b/folsom/src/main/java/com/spotify/folsom/SrvResolver.java @@ -80,7 +80,9 @@ private SrvResolver(final DnsSrvResolver dnsSrvResolver, final String srvRecord) @Override public List resolve() { - return dnsSrvResolver.resolve(srvRecord).stream() + return dnsSrvResolver + .resolve(srvRecord) + .stream() .map(result -> new ResolveResult(result.host(), result.port(), result.ttl())) .collect(Collectors.toList()); } diff --git a/folsom/src/main/java/com/spotify/folsom/client/AllRequest.java b/folsom/src/main/java/com/spotify/folsom/client/AllRequest.java index a6976457..245a2450 100644 --- a/folsom/src/main/java/com/spotify/folsom/client/AllRequest.java +++ b/folsom/src/main/java/com/spotify/folsom/client/AllRequest.java @@ -31,7 +31,8 @@ default CompletionStage preMerge(CompletionStage stage) { T merge(List results); static MemcacheStatus mergeMemcacheStatus(final List results) { - return results.stream() + return results + .stream() .filter(status -> status != MemcacheStatus.OK) .findFirst() .orElse(MemcacheStatus.OK); diff --git a/folsom/src/main/java/com/spotify/folsom/client/ascii/DefaultAsciiMemcacheClient.java b/folsom/src/main/java/com/spotify/folsom/client/ascii/DefaultAsciiMemcacheClient.java index 27cdfc1d..3b6fe76f 100644 --- a/folsom/src/main/java/com/spotify/folsom/client/ascii/DefaultAsciiMemcacheClient.java +++ b/folsom/src/main/java/com/spotify/folsom/client/ascii/DefaultAsciiMemcacheClient.java @@ -379,7 +379,10 @@ public RawMemcacheClient getRawMemcacheClient() { @Override public Map> getAllNodes() { - return rawMemcacheClient.getAllNodes().entrySet().stream() + return rawMemcacheClient + .getAllNodes() + .entrySet() + .stream() .collect(Collectors.toMap(Map.Entry::getKey, entry -> withClient(entry.getValue()))); } diff --git a/folsom/src/main/java/com/spotify/folsom/client/binary/DefaultBinaryMemcacheClient.java b/folsom/src/main/java/com/spotify/folsom/client/binary/DefaultBinaryMemcacheClient.java index ecab07ee..5d8a0fdc 100644 --- a/folsom/src/main/java/com/spotify/folsom/client/binary/DefaultBinaryMemcacheClient.java +++ b/folsom/src/main/java/com/spotify/folsom/client/binary/DefaultBinaryMemcacheClient.java @@ -470,7 +470,10 @@ public RawMemcacheClient getRawMemcacheClient() { @Override public Map> getAllNodes() { - return rawMemcacheClient.getAllNodes().entrySet().stream() + return rawMemcacheClient + .getAllNodes() + .entrySet() + .stream() .collect(Collectors.toMap(Map.Entry::getKey, entry -> withClient(entry.getValue()))); } diff --git a/folsom/src/main/java/com/spotify/folsom/ketama/KetamaMemcacheClient.java b/folsom/src/main/java/com/spotify/folsom/ketama/KetamaMemcacheClient.java index c1729b65..ebf88c5d 100644 --- a/folsom/src/main/java/com/spotify/folsom/ketama/KetamaMemcacheClient.java +++ b/folsom/src/main/java/com/spotify/folsom/ketama/KetamaMemcacheClient.java @@ -80,7 +80,8 @@ public CompletionStage send(final Request request) { private CompletionStage sendToAll(final AllRequest request) { final List> futures = - clients.stream() + clients + .stream() .map(client -> client.send(request.duplicate())) .map(request::preMerge) .collect(Collectors.toList()); diff --git a/folsom/src/main/java/com/spotify/folsom/ketama/ResolvingKetamaClient.java b/folsom/src/main/java/com/spotify/folsom/ketama/ResolvingKetamaClient.java index b1e66409..46dfb0c7 100644 --- a/folsom/src/main/java/com/spotify/folsom/ketama/ResolvingKetamaClient.java +++ b/folsom/src/main/java/com/spotify/folsom/ketama/ResolvingKetamaClient.java @@ -103,12 +103,14 @@ public void resolve() { } final Set newAddresses = - lookupResults.stream() + lookupResults + .stream() .map(result -> HostAndPort.fromParts(result.getHost(), result.getPort())) .collect(Collectors.toSet()); final long resolvedTtl = - lookupResults.stream() + lookupResults + .stream() .mapToLong(Resolver.ResolveResult::getTtl) .min() .orElse(Long.MAX_VALUE); @@ -206,7 +208,9 @@ private void setPendingClient(final ImmutableList.Builder rem shutdownQueue.addAll(removedClients.build()); final List addressAndClients = - clients.entrySet().stream() + clients + .entrySet() + .stream() .map(e -> new AddressAndClient(e.getKey(), e.getValue())) .collect(Collectors.toList()); diff --git a/folsom/src/test/java/com/spotify/folsom/ResolveKetamaIntegrationTest.java b/folsom/src/test/java/com/spotify/folsom/ResolveKetamaIntegrationTest.java index 7b6d10db..498da5cc 100644 --- a/folsom/src/test/java/com/spotify/folsom/ResolveKetamaIntegrationTest.java +++ b/folsom/src/test/java/com/spotify/folsom/ResolveKetamaIntegrationTest.java @@ -60,7 +60,8 @@ public void setUp() throws Exception { } public static List toResult(List servers) { - return servers.stream() + return servers + .stream() .map(server -> LookupResult.create(server.getHost(), server.getPort(), 100, 100, 100)) .collect(Collectors.toList()); } diff --git a/pom.xml b/pom.xml index 8de93a85..ca2ab789 100644 --- a/pom.xml +++ b/pom.xml @@ -159,9 +159,9 @@ - com.spotify.fmt + com.coveo fmt-maven-plugin - 2.21.1 + 2.5.1 @@ -185,7 +185,7 @@ - com.spotify.fmt + com.coveo fmt-maven-plugin From 08d48849f9026d2095c42a2b55ffa580f9b889d2 Mon Sep 17 00:00:00 2001 From: Thiago Cesar Jasper Moreira Date: Tue, 12 Dec 2023 11:26:20 +0000 Subject: [PATCH 3/3] Modernize dependencies and format --- folsom/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folsom/pom.xml b/folsom/pom.xml index d8f7842f..1a8fe5bd 100644 --- a/folsom/pom.xml +++ b/folsom/pom.xml @@ -67,7 +67,7 @@ ch.qos.logback logback-classic - 1.4.14 + 1.3.14 test