mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 09:20:29 +01:00
Update to aws sdk 2.23.8 and use AwsCrtHttpClient
This commit is contained in:
@@ -3,7 +3,7 @@ package org.whispersystems.textsecuregcm.util;
|
||||
import org.whispersystems.textsecuregcm.configuration.DynamoDbClientConfiguration;
|
||||
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
|
||||
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
|
||||
import software.amazon.awssdk.http.apache.ApacheHttpClient;
|
||||
import software.amazon.awssdk.http.crt.AwsCrtHttpClient;
|
||||
import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient;
|
||||
import software.amazon.awssdk.regions.Region;
|
||||
import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient;
|
||||
@@ -19,8 +19,9 @@ public class DynamoDbFromConfig {
|
||||
.apiCallTimeout(config.clientExecutionTimeout())
|
||||
.apiCallAttemptTimeout(config.clientRequestTimeout())
|
||||
.build())
|
||||
.httpClientBuilder(ApacheHttpClient.builder()
|
||||
.maxConnections(config.maxConnections()))
|
||||
.httpClientBuilder(AwsCrtHttpClient
|
||||
.builder()
|
||||
.maxConcurrency(config.maxConnections()))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2024 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
package org.whispersystems.textsecuregcm.util;
|
||||
|
||||
import io.dropwizard.lifecycle.Managed;
|
||||
import software.amazon.awssdk.crt.CRT;
|
||||
|
||||
/**
|
||||
* The AWS CRT client registers its own JVM shutdown handler which makes sure asynchronous operations in the CRT don't
|
||||
* call back into the JVM after the JVM shuts down. Unfortunately, this hook kills all outstanding operations using the
|
||||
* CRT, even though we typically orchestrate a graceful shutdown where we give outstanding requests time to complete.
|
||||
*
|
||||
* The CRT lets you take over the shutdown sequencing by incrementing/decrementing a ref count, so we introduce a
|
||||
* lifecycle object that will be shutdown after our graceful shutdown process.
|
||||
*/
|
||||
public class ManagedAwsCrt implements Managed {
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
CRT.acquireShutdownRef();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
CRT.releaseShutdownRef();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user