Un-manage FaultTolerantRedisCluster so it shuts down at JVM shutdown instead of Jetty shutdown.
This commit is contained in:
parent
7cb24dd96d
commit
7bf8650d59
|
@ -382,7 +382,6 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
|
|||
environment.lifecycle().manage(messagesCache);
|
||||
environment.lifecycle().manage(accountDatabaseCrawler);
|
||||
environment.lifecycle().manage(remoteConfigsManager);
|
||||
environment.lifecycle().manage(cacheCluster);
|
||||
environment.lifecycle().manage(clusterMessagePersister);
|
||||
|
||||
AWSCredentials credentials = new BasicAWSCredentials(config.getCdnConfiguration().getAccessKey(), config.getCdnConfiguration().getAccessSecret());
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.whispersystems.textsecuregcm.redis;
|
|||
|
||||
import com.codahale.metrics.SharedMetricRegistries;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import io.dropwizard.lifecycle.Managed;
|
||||
import io.github.resilience4j.circuitbreaker.CircuitBreaker;
|
||||
import io.lettuce.core.RedisURI;
|
||||
import io.lettuce.core.cluster.RedisClusterClient;
|
||||
|
@ -23,7 +22,7 @@ import java.util.stream.Collectors;
|
|||
* read and write operations because the leader in a Redis cluster shard may fail while its read-only replicas can still
|
||||
* serve traffic.
|
||||
*/
|
||||
public class FaultTolerantRedisCluster implements Managed {
|
||||
public class FaultTolerantRedisCluster {
|
||||
|
||||
private final RedisClusterClient clusterClient;
|
||||
|
||||
|
@ -56,6 +55,10 @@ public class FaultTolerantRedisCluster implements Managed {
|
|||
FaultTolerantRedisCluster.class);
|
||||
}
|
||||
|
||||
void shutdown() {
|
||||
clusterClient.shutdown();
|
||||
}
|
||||
|
||||
public void useReadCluster(final Consumer<StatefulRedisClusterConnection<String, String>> consumer) {
|
||||
this.readCircuitBreaker.executeRunnable(() -> consumer.accept(stringClusterConnection));
|
||||
}
|
||||
|
@ -87,13 +90,4 @@ public class FaultTolerantRedisCluster implements Managed {
|
|||
public <T> T withBinaryWriteCluster(final Function<StatefulRedisClusterConnection<byte[], byte[]>, T> consumer) {
|
||||
return this.writeCircuitBreaker.executeSupplier(() -> consumer.apply(binaryClusterConnection));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
clusterClient.shutdown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public abstract class AbstractRedisClusterTest {
|
|||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
redisCluster.stop();
|
||||
redisCluster.shutdown();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
|
|
Loading…
Reference in New Issue