hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ortwin Glück (JIRA) <j...@apache.org>
Subject [jira] Commented: (HTTPCLIENT-720) HttpClient Resource Adapter (JCA1.5)
Date Tue, 18 Dec 2007 16:07:43 GMT

    [ 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())
        //todo: how to delegate close to the underlying managedConnection?
    public HttpMethod getHttpMethod() { return getManagedConnection().getHttpMethod(); }
    public int execute() throws ResourceException {
        try {
            int rc = getManagedConnection().getHttpClientRaMcf().getHttpClientRa().
            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

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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message