• Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpUrlConnection.getStatusCode hangs forever (without exceptions)

 
Part Secret
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello for all.

I'm working in a java ear application with a web application module. In this module threre is a class that calls other web application (hosted in the same application server - Glassfish 2.1), through a HttpUrlConnection.

The problem is... When I click on the button wich calls the method to invoke the other web application, it works fine. But, when I open too many tags on browser, and click fast on the same button. This is, when I call the method often (to invoke the other web application). The method hangs on the line "HttpUrlConnection.getStatusCode()".

I searched about this on google... I has tried put the property "setRequestProperty("Connection", "Close")", and the property "setReadTimeout(5000)". But it does not work.

I has tried put a semaphore control on the method (wich calls the other web application), so each call is independent of the others calls (I broke the simultaneity).

I do not know what is the problem exactly. But when I call the HttpUrlConnection.getStatusCode() too many times... So the method hangs forever (it does not return, and it doe not throw any exception).

Ps.: I'm doing a post http call. And I'm using JDK 6.

I hope someone can help me.

Thankful.

Part_Secret
 
ntumba lobo
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like your method is just waiting on some resource to be freed to carry on.
If that's the case that explains why there is no error.

As to know which resource exactly,it is hard to tell it may be specific to your aplication
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!