Return-Path: Delivered-To: apmail-axis-java-dev-archive@www.apache.org Received: (qmail 7064 invoked from network); 17 Sep 2010 11:55:57 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Sep 2010 11:55:57 -0000 Received: (qmail 61787 invoked by uid 500); 17 Sep 2010 11:55:56 -0000 Delivered-To: apmail-axis-java-dev-archive@axis.apache.org Received: (qmail 61200 invoked by uid 500); 17 Sep 2010 11:55:52 -0000 Mailing-List: contact java-dev-help@axis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@axis.apache.org Delivered-To: mailing list java-dev@axis.apache.org Received: (qmail 61192 invoked by uid 99); 17 Sep 2010 11:55:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Sep 2010 11:55:51 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of amilasuriarachchi@gmail.com designates 209.85.214.45 as permitted sender) Received: from [209.85.214.45] (HELO mail-bw0-f45.google.com) (209.85.214.45) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Sep 2010 11:55:44 +0000 Received: by bwz4 with SMTP id 4so2685898bwz.32 for ; Fri, 17 Sep 2010 04:55:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=ZwzLgqDZIcTZjYZMEo0SpxP7EEQR4RN8aWqHWGVTiyI=; b=vF7EKvixKlmo73YwlkCLVUSso9+kg6NDEfKCLeJeN1fs8CFM0/UFC5OQObPWeuR8HX ++fJdPKJeDIOVHJ/kcEGCJrCzyZ5gpwTc+ql6vMEJ7GPZ4c5vsETIQ3dKHEjm0dfro9M zFjvTgYha82Opwn7w2UgoXFg3CbbHGHfJfQW8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=LEqxWw9EhSG/B4ZzXo5ER3853XiP+7XOE/dtzn2xKt96jbRWzJ5RB3HFkOZv0A6JUj XW8yFOxi3R5B+Xe5P/M+VTfPKwADmjOReA9AzT0qPf3Wd7xU+YsRkHVxJIlHm319FgWE hqCpf4g++W3yD1tfc3nAg11RRM1CfQVF7IPiI= MIME-Version: 1.0 Received: by 10.239.181.73 with SMTP id l9mr277460hbg.100.1284724523584; Fri, 17 Sep 2010 04:55:23 -0700 (PDT) Received: by 10.239.131.8 with HTTP; Fri, 17 Sep 2010 04:55:23 -0700 (PDT) In-Reply-To: References: Date: Fri, 17 Sep 2010 17:25:23 +0530 Message-ID: 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 From: Amila Suriarachchi To: java-dev@axis.apache.org Content-Type: multipart/alternative; boundary=001485f45490dcce4e0490733c82 X-Virus-Checked: Checked by ClamAV on apache.org --001485f45490dcce4e0490733c82 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Sep 17, 2010 at 10:41 AM, Jarek Gawor wrote: > On Thu, Sep 16, 2010 at 3:47 AM, Amila Suriarachchi > 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/ --001485f45490dcce4e0490733c82 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Fri, Sep 17, 2010 at 10:41 AM, Jarek = Gawor <jgawor@gmai= l.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 deta= ils. The
thread safety problem was solved by not reusing HttpClient instance.

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

this is the original cod= e.
HttpClient httpClient;
=A0=A0=A0=A0=A0=A0=A0 Object reuse =3D msgContext= .getOptions().getProperty(HTTPConstants.REUSE_HTTP_CLIENT);
=A0=A0=A0=A0= =A0=A0=A0 if (reuse =3D=3D null) {
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 reu= se =3D msgContext.getConfigurationContext().getProperty(HTTPConstants.REUSE= _HTTP_CLIENT);
=A0=A0=A0=A0=A0=A0=A0 }

=A0=A0=A0=A0=A0=A0=A0 if (reuse !=3D null &a= mp;& JavaUtils.isTrueExplicitly(reuse)) {
=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 httpClient =3D (HttpClient) msgContext.getOptions().getProperty(H= TTPConstants.CACHED_HTTP_CLIENT);
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (= httpClient =3D=3D null) {
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 httpClient =3D (HttpClient) m= sgContext.getConfigurationContext()
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 .getProperty(HTTPConstants.CACHED_HTTP_CL= IENT);
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 if (httpClient !=3D null)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 return httpClient;
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 MultiThreadedHttpConnectionManager connec= tionManager =3D
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 new MultiThreadedHttpConnectionManager();
=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 httpClient =3D new HttpClient(connectionManager);
=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 msgContext.getConfigurationContext()
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 .setProperty(HTTP= Constants.CACHED_HTTP_CLIENT, httpClient);
=A0=A0=A0=A0=A0=A0=A0 } else = {
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 HttpConnectionManager connManager = =3D
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (HttpConne= ctionManager) msgContext.getProperty(
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER);
=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 if (connManager =3D=3D null) {
=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 connManager =3D
=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (HttpConnectionManager) msgConte= xt.getProperty(
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 HTTPConstants.MUTTITHREAD_HTTP_CONNECTION_MANAGER);
= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if= (connManager !=3D null) {
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= httpClient =3D new HttpClient(connManager);
=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 } else {
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 //Multi threaded http connect= ion manager has set as the default
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 connManager =3D new MultiThreadedHttpConnectionManager();
=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 httpClient =3D new HttpClient(co= nnManager);
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
=A0=A0=A0=A0=A0=A0=A0 }

=A0=A0=A0=A0=A0=A0=A0 // Get the timeout val= ues set in the runtime
=A0=A0=A0=A0=A0=A0=A0 initializeTimeouts(msgConte= xt, httpClient);

=A0=A0=A0=A0=A0=A0=A0 return httpClient;

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

I'll revert this cha= nge since issue you point out is not applicable here.

thanks,
Am= ila.

>> 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 whate= ver
>> reason wasn't merged into trunk.
>
> I think the reason is that there was not proper discussion on axis2-de= v 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 Suria= rachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/
--001485f45490dcce4e0490733c82--