Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0FEFE200CB5 for ; Wed, 12 Jul 2017 18:57:34 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0E55C169A7C; Wed, 12 Jul 2017 16:57:34 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2C83E169A71 for ; Wed, 12 Jul 2017 18:57:33 +0200 (CEST) Received: (qmail 2318 invoked by uid 500); 12 Jul 2017 16:57:32 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 2306 invoked by uid 99); 12 Jul 2017 16:57:32 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Jul 2017 16:57:32 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 8CAAD195CCA for ; Wed, 12 Jul 2017 16:57:31 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.799 X-Spam-Level: * X-Spam-Status: No, score=1.799 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, SPF_HELO_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id IscpdOWHA5fT for ; Wed, 12 Jul 2017 16:57:29 +0000 (UTC) Received: from mailbox.servedge.com (72.103.82.208.static.ipv4.dnsptr.net [208.82.103.72]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 13FD06262A for ; Wed, 12 Jul 2017 16:57:28 +0000 (UTC) Received: (qmail 32543 invoked by uid 513); 12 Jul 2017 11:57:27 -0500 Received: from pool-173-66-116-184.washdc.fios.verizon.net (HELO Christophers-iMac.local) (chris@christopherschultz.net@173.66.116.184) by mailbox.servedge.com with AES128-SHA encrypted SMTP; 12 Jul 2017 11:57:27 -0500 Subject: Re: Possible to change default value for staleConnectionCheckEnabled? From: Christopher Schultz To: httpclient-users@hc.apache.org Reply-To: HttpClient User Discussion References: <2045dc0d-6ff1-3414-5bba-22ea2f8fd598@christopherschultz.net> Message-ID: Date: Wed, 12 Jul 2017 12:57:27 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <2045dc0d-6ff1-3414-5bba-22ea2f8fd598@christopherschultz.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit archived-at: Wed, 12 Jul 2017 16:57:34 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Gary, On 7/12/17 12:17 PM, Christopher Schultz wrote: > Gary, > > On 7/12/17 12:05 PM, Christopher Schultz wrote: >> Gary, > >> Nope. That field is 100% undocumented >> (https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/or g > >> /apache/http/client/config/RequestConfig.html#DEFAULT) >> so messing-around with it seems like a bad idea. > >> What do you suggest, specifically? It's a static final field, but >> I don't believe we are running under a SecurityManager, so I >> could probably use reflection to blast-away the value with one of >> my choosing. > >> I haven't looked at the code... is the DEFAULT object cloned (at >> least semantically) whenever a new RequestConfig object is built >> to act as the default values for everything? > > Looks like not. I don't see that RequestConfig.DEFAULT is useful > in any way, unless client code decides to use it for some reason. The client code in question looks like this: === PoolingHttpClientConnectionManager httpClientConnectionManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry); httpClientConnectionManager.setDefaultMaxPerRoute(5); httpClientConnectionManager.setDefaultSocketConfig(SocketConfig.custom() .setSoTimeout(timeout).build()); client = HttpClients.custom().setConnectionManager(httpClientConnectionManager).b uild(); requestConfig = RequestConfig.custom().setConnectTimeout(CONNECT_TIMEOUT).setConnectionR equestTimeout(CONNECT_TIMEOUT).setSocketTimeout(timeout).build(); === I'm not sure there is a way to do this other than with some really ugly reflection from outside code. Any suggestions? Thanks, - -chris >> On 2017-07-11 18:43 (-0400), Gary Gregory >> wrote: >>> Hi Chris, >>> >>> Have you tried resetting >>> org.apache.http.client.config.RequestConfig.DEFAULT? >>> >>> Gary >>> >>> On Tue, Jul 11, 2017 at 12:54 PM, Christopher Schultz >>> wrote: >>> >>>> All, >>>> >>>> I have a conflict between two products that must operate in >>>> the same JVM and same ClassLoader. One product was based >>>> upon http-client 4.3 and another based upon 4.5. Nearly >>>> everything works (thanks for the great backward >>>> compatibility, folks!) except that the product relying upon >>>> 4.3 semantics is expecting the default value for >>>> staleConnectionCheckEnabled to be "true" while it is "false" >>>> in the latest versions. >>>> >>>> Unfortunately, patching the code of the "older" product is >>>> very ... challenging. >>>> >>>> Is there a system property or anything like that I can use >>>> to change this default? Maybe a static >>>> setDefaultStateConnectionCheckEnabled(boolean) method? I >>>> realize that the whole staleConnectionCheckEnabled setting is >>>> deprecated, but having changed the default value for it is >>>> causing me some backward-compatibility headaches. >>>> >>>> Thanks, -chris >>>> >>>> ------------------------------------------------------------------- - - > >>>> - - >>>> >>>> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org >>>> For additional commands, e-mail: >>>> httpclient-users-help@hc.apache.org >>>> >>>> >>> > >> --------------------------------------------------------------------- > >> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org >> For additional commands, e-mail: >> httpclient-users-help@hc.apache.org > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org > For additional commands, e-mail: > httpclient-users-help@hc.apache.org > -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJZZlT3AAoJEBzwKT+lPKRYehMP+gPqxIMnSrTEMTYg99Dk2yb6 myRvi97sW6648hlzRgRO7VvIHKGoK4ggPn3TRcwCuczyS3Ik/FMXmoGhdYgutnIT 41krI3zE2ZTTp+N4IMgQW6c5MHkALXw91Dd95cSAHAJEEsISSSNwSkhmylgtc4SI ITRW8wAmqXRMUT+OZ28WIEzRsgnRcFhfnbSPAsQGbYaxJKk2ZWNenoNHCLJbtq47 JOzOJs4RsuZHk7n0CbOo5D3lUbo+FywYIvQRUD9zSN1k+Kjw4pyzodTjFoMDuIrI I3U4VwF+jYFonua/Wh+GBaXWewVV1aBXoXSGmZJdlaXqwGwx6R0h5/b6Y/hGg+To ahtMMcg2c+1A1S3+lZnrNVcbEGC2L6Izfnz2UBVQrG5tYUDT7nMwfIZnjNi2WPtA pmKST+owTeI0ETwLGLV8h6TFcAz8F40H5TmV+7nlbRGT8TkwVNzTWXy0yQnYB+Ey qkNIsjWA2OMiZv7eIr/5JN61c4RNqbDx9Br2oLZPrx4zLHLNiIxFCDi8M7Ba9gwB NMHz1c0SSx+5PIouWnDuEsTMJ4aAHOyKJku9LKUrQgD6IG2lT5YiMt7wQLVCF0/c kkLpMKGevrndym/RlcfzuR5uMlj8I7dxmiRmQOWV22oQLASOc4WtKZzb90pu6rtb gE/0ir+y89BoI10ZG1oc =/Ygm -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org