Skip to content

Commit

Permalink
Turns off connection cache but allows enabling this with newly define…
Browse files Browse the repository at this point in the history
…d property. Minor cleanup in pom file.
  • Loading branch information
spericas committed Sep 19, 2023
1 parent 4b26640 commit 1d7f235
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import static io.helidon.jersey.connector.HelidonProperties.DEFAULT_HEADERS;
import static io.helidon.jersey.connector.HelidonProperties.PROTOCOL_CONFIGS;
import static io.helidon.jersey.connector.HelidonProperties.PROTOCOL_ID;
import static io.helidon.jersey.connector.HelidonProperties.SHARE_CONNECTION_CACHE;
import static io.helidon.jersey.connector.HelidonProperties.TLS;
import static org.glassfish.jersey.client.ClientProperties.CONNECT_TIMEOUT;
import static org.glassfish.jersey.client.ClientProperties.FOLLOW_REDIRECTS;
Expand Down Expand Up @@ -119,6 +120,11 @@ class HelidonConnector implements Connector {
builder.defaultHeadersMap(getValue(properties, DEFAULT_HEADERS, EMPTY_MAP_LIST));
}

// connection sharing defaults to false in this connector
if (properties.containsKey(SHARE_CONNECTION_CACHE)) {
builder.shareConnectionCache(getValue(properties, SHARE_CONNECTION_CACHE, false));
}

webClient = builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,14 @@ private HelidonProperties() {
* @see io.helidon.webclient.api.HttpClientRequest#protocolId(String)
*/
public static final String PROTOCOL_ID = "jersey.connector.helidon.protocolId";

/**
* Property name to enable or disable connection caching in the underlying {@link WebClient}.
* The default for the Helidon connector is {@code false}, or no sharing (which is the
* opposite of {@link WebClient}). Set this property to {@code true} to enable connection
* caching.
*
* @see io.helidon.webclient.api.WebClientConfig.Builder#shareConnectionCache(boolean)
*/
public static final String SHARE_CONNECTION_CACHE = "jersey.connector.helidon.shareConnectionCache";
}
5 changes: 0 additions & 5 deletions jersey/tests/connector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@
<artifactId>helidon-common-testing-http-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.helidon.webclient</groupId>
<artifactId>helidon-webclient-http2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down

0 comments on commit 1d7f235

Please sign in to comment.