axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amila Suriarachchi <amilasuriarach...@gmail.com>
Subject Re: svn commit: r992877 - in /axis/axis2/java/core/trunk: ./ modules/adb-codegen/test-resources/testsuite/ modules/adb-codegen/test/org/apache/axis2/schema/particlemaxoccurs/ modules/kernel/src/org/apache/axis2/jsr181/ modules/kernel/src/org/apache/a
Date Fri, 17 Sep 2010 11:55:23 GMT
On Fri, Sep 17, 2010 at 10:41 AM, Jarek Gawor <jgawor@gmail.com> wrote:

> On Thu, Sep 16, 2010 at 3:47 AM, Amila Suriarachchi
> <amilasuriarachchi@gmail.com> wrote:
> >
> >> The key idea of these changes were to ensure that connection reuse is
> >> done properly (in thread safe way).
> >
> > Can you please explain this problem with the code with revision 909680.
> >
> > After that you have commit twice and Andreas has revert them and merge
> with
> > Axis2 1.5.
> >
> > if there is a thread safe problem then we need to fix that. But what I am
> > saying is that
> > we should not do any other change unless it solves every thing out of the
> > box.
>
> See https://issues.apache.org/jira/browse/AXIS2-4751 for details. The
> thread safety problem was solved by not reusing HttpClient instance.
>

As I told, this bug is reported with Axis2 1.5.1 not with trunk. hence this
issue is not relevant.

this is the original code.
HttpClient httpClient;
        Object reuse =
msgContext.getOptions().getProperty(HTTPConstants.REUSE_HTTP_CLIENT);
        if (reuse == null) {
            reuse =
msgContext.getConfigurationContext().getProperty(HTTPConstants.REUSE_HTTP_CLIENT);
        }

        if (reuse != null && JavaUtils.isTrueExplicitly(reuse)) {
            httpClient = (HttpClient)
msgContext.getOptions().getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
            if (httpClient == null) {
                httpClient = (HttpClient)
msgContext.getConfigurationContext()
                        .getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
            }
            if (httpClient != null)
                return httpClient;
            MultiThreadedHttpConnectionManager connectionManager =
                    new MultiThreadedHttpConnectionManager();
            httpClient = new HttpClient(connectionManager);
            msgContext.getConfigurationContext()
                    .setProperty(HTTPConstants.CACHED_HTTP_CLIENT,
httpClient);
        } else {
            HttpConnectionManager connManager =
                    (HttpConnectionManager) msgContext.getProperty(

HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
            if (connManager == null) {
                connManager =
                        (HttpConnectionManager) msgContext.getProperty(

HTTPConstants.MUTTITHREAD_HTTP_CONNECTION_MANAGER);
            }
            if (connManager != null) {
                httpClient = new HttpClient(connManager);
            } else {
                //Multi threaded http connection manager has set as the
default
                connManager = new MultiThreadedHttpConnectionManager();
                httpClient = new HttpClient(connManager);
            }
        }

        // Get the timeout values set in the runtime
        initializeTimeouts(msgContext, httpClient);

        return httpClient;

it reuses http client only if user has set so. otherwise if the user has set
an http connection manager object then
it creates a new httpClient per every call.

I'll revert this change since issue you point out is not applicable here.

thanks,
Amila.

>
> >> The idea of connection reuse by
> >> default was a secondary thought. Connection reuse by default was
> >> enabled in the 1.5 branch (before any of my changes) but for whatever
> >> reason wasn't merged into trunk.
> >
> > I think the reason is that there was not proper discussion on axis2-dev
> list
> > about this change and the
> > side effects it introduces.
>
> Start a new thread and let's discuss if connection caching should be
> done by default or not.
>
> Jarek
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-dev-help@axis.apache.org
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Mime
View raw message