Java URLConnection to JBoss Lags

Solution Verified - Updated -

Issue

  • In this scenario, there are multiple sequential HTTP requests being made in rapid succession (code example below) from a standalone Java client to a JBoss instance.  There is a lot of "lag" time between each request

    for (String url : urls) {
         URL realURL = new URL(args[0] + "/"
                   + url.replaceAll("\\{sid\\}", args[1]));
    
         HttpURLConnection connection = (HttpURLConnection) realURL
                   .openConnection();
         connection.setRequestMethod("GET");
         connection.connect();
    
         InputStream stream = connection.getInputStream();
         InputStreamReader reader = new InputStreamReader(stream);
         while (reader.read() != -1) {
         }
    }
    

Environment

  • JBoss Enterprise Application Platform 4.x
  • JBoss Enterprise Application Platform 5.x
  • Java SE 6.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.