Skip to content

Proper client setup for multithreaded environment and lock contention on client initialization #5650

Answered by ptorkko
ptorkko asked this question in Q&A
Discussion options

You must be logged in to vote

Ok I dug a bit deeper and i'm not sure where my original assumptions came from.

with the following:

var target = client.target("https://myapi.com/");
if (target instanceof JerseyWebTarget jwt) jwt.preinitialize();

var actualApiTarget = target.path("v1").path("fancyapi").path(someDynamicPathPAram).queryParam("query", "indeed");

actualApiTarget.request("application/json").....

It seems each new JerseyWebTarget created from .path or .queryParam etc calls actually just retain the initially inizialied client runtime as it's passed with the ClientConfig to each new instance.

As long as the targets are configured at this point and no changes are needed, we should be fine with a setup where we…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ptorkko
Comment options

@ptorkko
Comment options

Answer selected by ptorkko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants