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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content