Skip to content

Commit

Permalink
[repository-azure] Update to the latest Azure Storage SDK v12, remove…
Browse files Browse the repository at this point in the history
… privileged runnable wrapper in favor of access helper (opensearch-project#1521)

Signed-off-by: Andriy Redko <[email protected]>
  • Loading branch information
reta committed Nov 11, 2021
1 parent 9fd4b35 commit fcbdecf
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 24 deletions.
14 changes: 7 additions & 7 deletions plugins/repository-azure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ opensearchplugin {
}

dependencies {
api 'com.azure:azure-core:1.20.0'
api 'com.azure:azure-storage-common:12.12.0'
api 'com.azure:azure-core-http-netty:1.11.0'
api 'com.azure:azure-core:1.22.0'
api 'com.azure:azure-storage-common:12.14.0'
api 'com.azure:azure-core-http-netty:1.11.2'
api "io.netty:netty-codec-dns:${versions.netty}"
api "io.netty:netty-codec-socks:${versions.netty}"
api "io.netty:netty-codec-http2:${versions.netty}"
api "io.netty:netty-handler-proxy:${versions.netty}"
api "io.netty:netty-resolver-dns:${versions.netty}"
api "io.netty:netty-transport-native-unix-common:${versions.netty}"
implementation project(':modules:transport-netty4')
api 'com.azure:azure-storage-blob:12.13.0'
api 'com.azure:azure-storage-blob:12.14.1'
api 'org.reactivestreams:reactive-streams:1.0.3'
api 'io.projectreactor:reactor-core:3.4.11'
api 'io.projectreactor.netty:reactor-netty:1.0.12'
api 'io.projectreactor.netty:reactor-netty-core:1.0.12'
api 'io.projectreactor.netty:reactor-netty-http:1.0.12'
api 'io.projectreactor.netty:reactor-netty:1.0.13'
api 'io.projectreactor.netty:reactor-netty-core:1.0.13'
api 'io.projectreactor.netty:reactor-netty-http:1.0.13'
api "org.slf4j:slf4j-api:${versions.slf4j}"
api "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}"
api "com.fasterxml.jackson.core:jackson-databind:${versions.jackson}"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
194b21b804c20c85f7d2a6199280075f6747e188

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7d84ec31d73a7b51bc72044789768b25fb2b14f4

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
384763aef32d779ee22ef3faa03049fee7e0f6de

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ed58d3438a7fa3a2a5e9f60c0111795101dc8bf6

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cf216a9ba6b50210664761add9db744c9c3f51d8

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a67949c5946dd66c7ab0a3b059213c23345c32b1

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
de7a38101098db9438c18fdd09acc5b79a2ec02a
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import com.azure.core.http.ProxyOptions.Type;
import com.azure.core.http.netty.NettyAsyncHttpClientBuilder;
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.core.util.Configuration;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.BlobServiceClient;
Expand All @@ -67,9 +68,7 @@
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URISyntaxException;
import java.security.AccessController;
import java.security.InvalidKeyException;
import java.security.PrivilegedAction;
import java.time.Duration;
import java.util.Arrays;
import java.util.HashMap;
Expand Down Expand Up @@ -103,6 +102,14 @@ public class AzureStorageService implements AutoCloseable {
volatile Map<String, AzureStorageSettings> storageSettings = emptyMap();
private final Map<AzureStorageSettings, ClientState> clients = new ConcurrentHashMap<>();

static {
// See please:
// - https://github.com/Azure/azure-sdk-for-java/issues/24373
// - https://github.com/Azure/azure-sdk-for-java/pull/25004
// - https://github.com/Azure/azure-sdk-for-java/pull/24374
Configuration.getGlobalConfiguration().put("AZURE_JACKSON_ADAPTER_USE_ACCESS_HELPER", "true");
}

public AzureStorageService(Settings settings) {
// eagerly load client settings so that secure settings are read
final Map<String, AzureStorageSettings> clientsSettings = AzureStorageSettings.load(settings);
Expand Down Expand Up @@ -366,14 +373,7 @@ private static class NioThreadFactory implements ThreadFactory {
}

public Thread newThread(Runnable r) {
// See please: https://github.com/Azure/azure-sdk-for-java/pull/24374
final Runnable priviledged = () -> {
AccessController.doPrivileged((PrivilegedAction<?>) () -> {
r.run();
return null;
});
};
final Thread t = new Thread(group, priviledged, namePrefix + threadNumber.getAndIncrement(), 0);
final Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0);

if (t.isDaemon()) {
t.setDaemon(false);
Expand Down

0 comments on commit fcbdecf

Please sign in to comment.