Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jersey-dev] [External] : How To Use Jersey Client Efficiently
  • From: Jan Supol <jan.supol@xxxxxxxxxx>
  • Date: Sun, 4 Jan 2026 18:52:19 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=41lDQkAoxbGUPTb7KxDXfPepI1eiemzvYdS2xVyVi7M=; b=bREhGRYtCgiQnekmnkEY5ja28N/4lCPiNfPL+1a9vKFVMikiC54VB6xXvOhRrlyR7WFXnaFwb2Kgygu8X2H53N/y2XHXDrfmNr9ZwiA2dxkH3rck3GUc5r9O6K6/sOjUHoURn2ZY5mPFwbSmWzCrZAiUqFoE/43yWt1paYeVMYBY1DMZ4VGJBzU03AjOEdkIJE+pOGTUqVF7a2cHTfAPxSl5/3FgyJYwfxi1neh2rAbmWddoVQVnH617C5/eBiBJcyj6DHa68QVdPNMi4JzDmE5d+GKlEIoUKRv9P5tAs1G/N93tjs/6AykLM9qJZqzNA8liXwpyotCtsnGeiUU2rw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pZeue/aj/JNGQLVLvtFH4QMseTrfPyWODIJQmF/wrVERCl3CzN1/uuwm7mUqOLNlpGkpNUzlbnFdbM71Q1Am6PoyapBmAZB0fWHHzOKP+cTOMfBWqle3dsz0INc3WifdTkmlhhIfDWxu/W0ix3AWbxH9ZmeUSwhsd2vOJPrHLDriYEUS89Ew6sW9GwUmPSgyZwRHUe3dLUMEuDCBcYbymLYlYykNzuAMhVNumdfjAd7MsmgiQ372G0CSsAIg4wp1g3bbQkk1nuOFb0OpRBow/nNsvVxh/BATHptlpPiF6x930kE45HX/prvKdrVowKUkrkFMNjDwd9i+YhhrjK5W5w==
  • Delivered-to: jersey-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/jersey-dev/>
  • List-help: <mailto:jersey-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/jersey-dev>, <mailto:jersey-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/jersey-dev>, <mailto:jersey-dev-request@eclipse.org?subject=unsubscribe>
  • Msip_labels: MSIP_Label_f3e58186-1c1b-4537-900b-8707ad116850_Enabled=True; MSIP_Label_f3e58186-1c1b-4537-900b-8707ad116850_SiteId=4e2c6054-71cb-48f1-bd6c-3a9705aca71b; MSIP_Label_f3e58186-1c1b-4537-900b-8707ad116850_SetDate=2026-01-04T18:52:18.866Z; MSIP_Label_f3e58186-1c1b-4537-900b-8707ad116850_Name=Internal; MSIP_Label_f3e58186-1c1b-4537-900b-8707ad116850_ContentBits=1; MSIP_Label_f3e58186-1c1b-4537-900b-8707ad116850_Method=Standard;
  • Thread-index: AQHceDEzf5p0nOCw9kCb5Gtg6/kN4rVCY0i3
  • Thread-topic: [External] : [jersey-dev] How To Use Jersey Client Efficiently

Hi Martynas,
Yes, this is still the same. When a WebTarget instance gets initialized - before the request, a costly injection framework (HK2) instance is created. Each feature is registered into the injection framework and to ensure the separation of features between the WebTarget instances, a new WebTarget needs a new injection framework instance. That's where the time is spent.
HTH,
Jan

Confidential- Oracle Internal

From: jersey-dev <jersey-dev-bounces@xxxxxxxxxxx> on behalf of Martynas Jusevičius via jersey-dev <jersey-dev@xxxxxxxxxxx>
Sent: Sunday, December 28, 2025 8:35 PM
To: jersey developer discussions <jersey-dev@xxxxxxxxxxx>
Cc: Martynas Jusevičius <martynas@xxxxxxxxxxxxx>
Subject: [External] : [jersey-dev] How To Use Jersey Client Efficiently
 
Hi,

There was this article from 2015 by Jakub Podlesak called How To Use
Jersey Client Efficiently.
It's gone from the Oracle site but can be found on the Wayback Machine:
https://urldefense.com/v3/__https://web.archive.org/web/20210420010938/https:/*blogs.oracle.com/japod/how-to-use-jersey-client-efficiently__;Lw!!ACWV5N9M2RV99hQ!IL5I1_uKkYpaJ5ory5lAu-oSbdP02kJBwE6QTWJ7afqzdKSXIZkdvhTT-Um2fTZ0am93fi3_axsS7EovaW3Ptg$

It says this about the 2.x Client API:
"Be careful when touching configuration of a web target!. What does it
mean? Whenever you create a new web target with updated configuration,
Jersey will effectively create a new client runtime. To keep your
application performing well, you should think of reusing all such web
targets."

Is this still the case using Jersey 3.x? Or is it fine to register
features directly on WebTargets?

Currently I am reusing the same Client instance to access multiple
different APIs.
However those APIs may require different features, e.g.
HttpAuthenticationFeature.
What is the standard solution here - use a Client per API or just
register the features on WebTarget? Maybe behind the scenes it's
effectively the same?

Thanks.

Martynas
atomgraph.com
_______________________________________________
jersey-dev mailing list
jersey-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://urldefense.com/v3/__https://www.eclipse.org/mailman/listinfo/jersey-dev__;!!ACWV5N9M2RV99hQ!IL5I1_uKkYpaJ5ory5lAu-oSbdP02kJBwE6QTWJ7afqzdKSXIZkdvhTT-Um2fTZ0am93fi3_axsS7Eqvo1uGYA$

Back to the top