Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5849783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T13:02:58+00:00 2026-05-22T13:02:58+00:00

I’ve been having a problem with the ClientResource in Restlet (v 2.0.5) which may

  • 0

I’ve been having a problem with the ClientResource in Restlet (v 2.0.5) which may be a consequence of not understanding its correct usage.

I’m using the ClientResource, with the Apache HTTP Client connector, and have written the following:

        private final ClientResource httpClient;
        public SendClient(String uri) {
            httpClient = new ClientResource(uri);
        }
        // Omitted code would create messages to send, and then use an executor
        // to send this particular message to its destination.
        public void run() {
           ClientResource sendClient = null;
           try {
              sendClient = wsClient.getChild(uriResource); // re-use original httpclient instance, uriResource is passed in to the method that calls this.
              sendClient.post(form);
           } catch (Throwable e) {
              logger.error("Unable to send message, {}", e.getMessage());
           } finally {
              if (sendClient != null) {
                 sendClient.release(); // As I understand from [Restlet WIKI][1] 
              }
           }
        }

Is this correct? I suspect that it is not, since after several hours (7 or more) this section of code starts throwing the following error, “Internal Server Error”, and messages are no longer received by the destination.

Any ideas of what I am doing incorrectly?

NOTE I am aware that ClientResource is not thread-safe, and you’ll notice that in my code I am using an executor to run this section of code, however, that executor contains only a single thread, so, until I understand otherwise, I’ve ruled out that as a problem.

NOTE 2: The ClientResource javadoc states: “Concurrency note: instances of the class are not designed to be shared among several threads. If thread-safety is necessary, consider using the lower-level Client class instead.” However, the restlet creator, says that in fact it is Thread-safe, just not explicitly designed for this purpose.
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T13:02:59+00:00Added an answer on May 22, 2026 at 1:02 pm

    ClientResource is thread safe, but it wasn’t especially designed to be used by several concurrent threads, even though it is possible. However, it is perfectly valid to reuse the same instance several times.

    Back to your problem, we would need a more detailed stack trace of your problem to help out, because the “Internal Server Error” leads to an issue on the server side rather than the client-side.

    Hope this helps,
    Jerome

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm looking for suggestions for debugging... If you view this site in Firefox or
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.