[
https://issues.apache.org/jira/browse/HTTPCLIENT-720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12552805
]
Ortwin Glück commented on HTTPCLIENT-720:
-----------------------------------------
Sagi, this doesn't make sense to me. The code completely consumes the response
(so the caller can not obtain it). Then the code fails to call
releaseConnection(). Also there is no documentation on the interfaces that
would give hints to correct use of the API. To me this looks like highly prone
to resource leaks - the least you want in an application server:
public void close() throws ResourceException {
if (logger().isDebugEnabled())
logger().debug("Closing");
//todo: how to delegate close to the underlying managedConnection?
getManagedConnection().close();
setManagedConnection(null);
}
public HttpMethod getHttpMethod() { return
getManagedConnection().getHttpMethod(); }
public int execute() throws ResourceException {
try {
int rc =
getManagedConnection().getHttpClientRaMcf().getHttpClientRa().
getHttpClient().executeMethod(getHttpMethod());
while (getHttpMethod().getResponseBodyAsStream().read() != -1);
return rc;
} catch (Throwable ex) {
throw new ResourceException("Failed to execute", ex);
}
}
Then the code uses some undocumented system properties:
com.retailermade.rqms.httpcra.proxy.user etc.
errm... and what is that exactly supposed to be: if
("nt".compareToIgnoreCase("") == 0) {
I am not sure how much sense it makes to access HttpClient over the resource
adapter API anyway. For me it would make the most sense to share a global Http
connection pool among different EJBs. But this code doesn't even attempt to use
the multithreaded connection manager, so it isn't even thread-safe!
All in all it looks like you have tried to solve a very specific problem for a
project. But what you have submitted here is far from a reusable generic
component. I highly discourage anyone from directly using this piece of code.
> HttpClient Resource Adapter (JCA1.5)
> ------------------------------------
>
> Key: HTTPCLIENT-720
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-720
> Project: HttpComponents HttpClient
> Issue Type: New Feature
> Components: Contrib
> Affects Versions: 3.1 Final
> Environment: JCA1.5-compliant application server
> Reporter: Sagi Mann
> Priority: Minor
> Fix For: 3.1 Final
>
> Attachments: HttpClientRA.zip
>
>
> Allow Java Enterprise applications (J2EE/JEE) to use HttpClient, by providing
> HttpClient as a standard Resource Adapter (JCA 1.5)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]