Skip to content

Commit

Permalink
set timeouts (#802)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan-Olav Eide <jan-olav.eide@nav.no>
  • Loading branch information
jan-olaveide and janolaveide authored May 11, 2021
1 parent 99625a6 commit 066438e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import static no.nav.vedtak.felles.integrasjon.rest.RestClientSupportProdusent.createKeepAliveStrategy;
import static no.nav.vedtak.felles.integrasjon.rest.RestClientSupportProdusent.defaultRequestConfig;
import static org.glassfish.jersey.apache.connector.ApacheConnectorProvider.getHttpClient;
import static org.glassfish.jersey.client.ClientProperties.CONNECT_TIMEOUT;
import static org.glassfish.jersey.client.ClientProperties.PROXY_URI;
import static org.glassfish.jersey.client.ClientProperties.READ_TIMEOUT;
import static org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS;
import static org.glassfish.jersey.logging.LoggingFeature.Verbosity.PAYLOAD_ANY;

Expand Down Expand Up @@ -112,12 +114,15 @@ private AbstractJerseyRestClient(URI proxy, Set<? extends ClientRequestFilter> f
LOG.info("Registrer filter {}", f.getClass());
cfg.register(f);
});

cfg.register(ErrorResponseHandlingClientResponseFilter.class);
if (ENV.isDev()) {
cfg.register(new LoggingFeature(java.util.logging.Logger.getLogger(getClass().getName()),
FINE, PAYLOAD_ANY, 10000));
}
client = ClientBuilder.newClient(cfg);
client.property(CONNECT_TIMEOUT, 10000);
client.property(READ_TIMEOUT, 30000);
}

private static JacksonJaxbJsonProvider jacksonProvider(ObjectMapper mapper) {
Expand Down

0 comments on commit 066438e

Please # to comment.