Skip to content

Commit

Permalink
Tiered Storage: add OkHttp based provider for JClouds (apache#15136)
Browse files Browse the repository at this point in the history
(cherry picked from commit a74527d)
  • Loading branch information
eolivelli authored and lhotari committed May 9, 2022
1 parent fc37bd3 commit 78ae7d6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
11 changes: 11 additions & 0 deletions jclouds-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@
<artifactId>jclouds-apachehc</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-okhttp</artifactId>
<version>${jclouds.version}</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-slf4j</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import lombok.extern.slf4j.Slf4j;
import org.jclouds.ContextBuilder;
import org.jclouds.http.apachehc.config.ApacheHCHttpCommandExecutorServiceModule;
import org.jclouds.http.okhttp.config.OkHttpCommandExecutorServiceModule;
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;

import java.util.ArrayList;
Expand All @@ -42,9 +43,12 @@ public class ShadedJCloudsUtils {
* Apache Http Client module should work well in all the environments.
*/
private static final boolean ENABLE_APACHE_HC_MODULE = Boolean
.parseBoolean(System.getProperty("pulsar.jclouds.use_apache_hc", "true"));
.parseBoolean(System.getProperty("pulsar.jclouds.use_apache_hc", "false"));
private static final boolean ENABLE_OKHTTP_MODULE = Boolean
.parseBoolean(System.getProperty("pulsar.jclouds.use_okhttp", "false"));
static {
log.info("Considering -Dpulsar.jclouds.use_apache_hc=" + ENABLE_APACHE_HC_MODULE);
log.info("Considering -Dpulsar.jclouds.use_okhttp=" + ENABLE_OKHTTP_MODULE);
}

/**
Expand All @@ -54,7 +58,9 @@ public class ShadedJCloudsUtils {
public static void addStandardModules(ContextBuilder builder) {
List<AbstractModule> modules = new ArrayList<>();
modules.add(new SLF4JLoggingModule());
if (ENABLE_APACHE_HC_MODULE) {
if (ENABLE_OKHTTP_MODULE) {
modules.add(new OkHttpCommandExecutorServiceModule());
} else if (ENABLE_APACHE_HC_MODULE) {
modules.add(new ApacheHCHttpCommandExecutorServiceModule());
}
builder.modules(modules);
Expand Down

0 comments on commit 78ae7d6

Please sign in to comment.