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

  • SEARCH
  • Home
  • 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 545379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:45:18+00:00 2026-05-13T10:45:18+00:00

During a server start-up procedure, I access a remote host for some initialisation data.

  • 0

During a server start-up procedure, I access a remote host for some initialisation data. Unfortunately, the remote host in question is notorious for being randomly unresponsive to connections (lets say 3% of the time this happens). The result is that the connection hangs indefinitely (possibly forever), and my server doesn’t start up in a reasonable amount of time, if at all. It’s hung for an hour before.

A connection timeout:

HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(connectionTimeout);

for (int i = 0; i <= connectionRetries; i++) {
  try {
    log.info("Establishing connection to ClassNotes service.");
    conn.connect();
    break;
  } catch (SocketTimeoutException e) {
    log.warn("Timed out connecting to ClassNotes service.");
  }
}

does not work, since the connection is already established with the server when it hangs. The problem seems to be when it tries to get an InputStream from the server.

For any one who has had to work with disobediant services, should I thread the process of getting the InputStream with a finite number of retries, and just deal with one or two potential threads hanging in the JVM’s memory indefinitely? Or, is there a more common way to handle this in Java?

It could also be useful to know that a server starting up without the information from the remote host is not as devastating as the server not starting up at all.

Thanks in advance.

  • 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-13T10:45:19+00:00Added an answer on May 13, 2026 at 10:45 am

    You can setReadTimeout() in addition to the connection timeout.

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

Sidebar

Related Questions

Using akka 1.3.1, I was able to previously do something like this: Actor.remote.start(config.server.host, config.server.port)
Scenario: The agent listens to a certain address/port during start up. When server started,
I have a client-server application that utilises MSMQ and NServiceBus for messaging. During some
How do we redirect error/failed data to another table in SQL Server, during data
I have remote logged into my machine and trying to start tomcat server. But,
In my application i am using XML file from server. So during start up
I am creating a SQL Server database programmatically during a conversion. If the conversion
During development, I usually test ASP.Net applications using the Web Development Server (sometimes called
Server Error in '/' Application. Parser Error Description: An error occurred during the parsing
I am trying to install RedMine on a server. During the procedures as explained

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.