Hi Marc,

I don't know if you still experiment issues with this, but here are a couple of 
clarifications:

1) release() has the effect of closing the underlying TCP socket, preventing 
persistent connection reuse. So it can't be recommended to systematically call 
it.

2) exhaust() does ensure a proper consumption of the entity and enable reuse of 
the connection. If you don't systematically consume the entity via other means 
(actually reading it), then calling exhaust() is the way to go.

Best regards,
Jerome
--
Restlet ~ Founder and Technical Lead ~ http://www.restlet.o​rg
Noelios Technologies ~ http://www.noelios.com



-----Message d'origine-----
De : Marc Portier [mailto:[email protected]] 
Envoyé : lundi 16 août 2010 12:04
À : [email protected]
Objet : response.release() versus response.exhaust() in 2.0

Hi all,

We've recently upgraded to restlet 2.0 and are facing a number of odd 'hangs' 
during our junit testcases.

As far as we can tell now, we're facing some variant of what is mentioned here:

http://restlet-discuss.1400322.n2.nabble.com/Suspended-thread-doing-Client-put-td4479317.html

And the answer there is that representations (actually the streams in
there) should be "exhausted" for sure.


Up to now we were more down the path of following the advise of

http://restlet-discuss.1400322.n2.nabble.com/Problem-with-HttpClient-extension-org-restlet-ext-httpclient-and-unreleased-connections-during-404s-td5284804.html#a5284804

Which points out representations should be "released" properly.
However in our case this doesn't seem to be enough any more.


Quickly scanning the code the biggest difference seems to be that 
streams are completely read-out before being closed in the exhaust().


My questions:
* Should both advises be combined into "assure exhaust _and_ release"?

* (For my interest) Why is reading the stream till the end making a 
difference anyway. What additional resource is cleaned up at the end of 
the stream that isn't/can't be freed upon close()?

* Is there a reason why release() is not automatically including exhaust()


regards,
-marc=

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2647412

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2694691

Reply via email to