Advertisement

04.17.2008 at 01:46AM PDT, ID: 23330128
[x]
Attachment Details

Hang when call releaseConnection()

Asked by TKD in Java Servlets, J2EE

Tags: Java

Hi, experts:
At server side, it sends the following HTTP message to a client:
=======================================
GET /Inform?c=testing HTTP/1.1
User-Agent: Jakarta Commons-HttpClient/3.1-rc1
Host: 140.92.63.241:8000
=======================================
The, the client responses to this
=======================================
HTTP/1.1 202 ACCEPTED
Server: gSOAP/2.7
Content-Type: text/xml; charset=utf-8
Content-Length: 0
Connection: close
Set-Cookie: visit=true;Domain=localhost;Path=/;Version=1;Max-Age=600
=======================================
At this time , the server calls releaseConnection method. But the connection isn't closed immediately.
The code is in "attach code snippet".
But I see that it hangs a while in releaseConnection() method. And I  use a debuger to trace what's the problem. And I see that releaseConnetion seems to wait something.  
How to let the connection close immediately?
Thank you.
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
{
// Send GET /Inform?c=testing HTTP/1.1 ... message
int statusCode = httpClient.executeMethod(httpGetMethod);
// Get the response
if (statusCode == HttpStatus.SC_OK)
{
	returnValue = true;
}
else
{
	logger.warn("Authentication of Trigger CPE is failure !!\nStatus Code = " + statusCode + "\nDescription: " + httpGetMethod.getStatusLine());
}
 
}
catch (Exception e)
{
	logger.error("", e);
}
finally
{
	// release any connection resources used by the method
	httpGetMethod.releaseConnection();
	return returnValue;
}
httpGetMethod.releaseConnection();
[+][-]04.18.2008 at 07:44AM PDT, ID: 21386219

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.20.2008 at 06:20PM PDT, ID: 21398199

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 12:42PM PDT, ID: 21405227

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Servlets, J2EE
Tags: Java
Sign Up Now!
Solution Provided By: bpmurray
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628