DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Why Queues Don’t Fix Scaling Problems
  • Reliable AI Agent Architecture for Mobile: Timeouts, Retries, and Idempotent Tool Calls
  • How to Identify the Underlying Causes of Connection Timeout Errors for MongoDB With Java
  • Understanding Server Error (5XX) in Azure Services: A Deep Dive Into Azure Logic Apps

Trending

  • Spec-Driven Integration: Turning API Sprawl Into a Governed Capability Fleet for AI
  • Manual Investigation: The Hidden Bottleneck in Incident Response
  • Hallucination Has Real Consequences — Lessons From Building AI Systems
  • The Prompt Isn't Hiding Inside the Image

Setting Timeout for the JAX-RS 2.0 / Resteasy Client

By 
Markus Eisele user avatar
Markus Eisele
·
Dec. 16, 14 · Interview
Likes (0)
Comment
Save
Tweet
Share
17.0K Views

Join the DZone community and get the full member experience.

Join For Free

Adam asked me about that at NetBeans Day in Munich. One part of the JAX-RS Client API isn't fully standardized but still very important looking at today's microservice architectures. I am talking about timeouts here. Adam showed how to set them for Jersey and I just needed to find out how to do the same with Resteasy.

import javax.ws.rs.client.Client;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;

 Client client = new ResteasyClientBuilder()
                .establishConnectionTimeout(100, TimeUnit.SECONDS)
                .socketTimeout(2, TimeUnit.SECONDS)
                .build();
ResteasyClientBuilder is basically an abstraction for creating Clients which uses Apache Http Client under the covers. That's it.
Timeout (computing)

Published at DZone with permission of Markus Eisele. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Why Queues Don’t Fix Scaling Problems
  • Reliable AI Agent Architecture for Mobile: Timeouts, Retries, and Idempotent Tool Calls
  • How to Identify the Underlying Causes of Connection Timeout Errors for MongoDB With Java
  • Understanding Server Error (5XX) in Azure Services: A Deep Dive Into Azure Logic Apps

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook