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 078B0200CCF for ; Mon, 24 Jul 2017 13:54:11 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 05CFC164F8B; Mon, 24 Jul 2017 11:54:11 +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 24E93164F87 for ; Mon, 24 Jul 2017 13:54:09 +0200 (CEST) Received: (qmail 30482 invoked by uid 500); 24 Jul 2017 11:54:09 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 30473 invoked by uid 99); 24 Jul 2017 11:54:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jul 2017 11:54:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id BFB11C01E5 for ; Mon, 24 Jul 2017 11:54:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id ZhFRdiyUAxqF for ; Mon, 24 Jul 2017 11:54:07 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 7F68E5FBE5 for ; Mon, 24 Jul 2017 11:54:06 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B848AE0DBE for ; Mon, 24 Jul 2017 11:54:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 221E421EE7 for ; Mon, 24 Jul 2017 11:54:00 +0000 (UTC) Date: Mon, 24 Jul 2017 11:54:00 +0000 (UTC) From: =?utf-8?Q?Rafa=C5=82_Ga=C5=82a_=28JIRA=29?= To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CAMEL-11590) Unnecessary connection opened when using custom AS400ConnectionPool MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 24 Jul 2017 11:54:11 -0000 [ https://issues.apache.org/jira/browse/CAMEL-11590?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] Rafa=C5=82 Ga=C5=82a updated CAMEL-11590: ------------------------------- Description:=20 When using a custom *AS400ConnectionPool* for *Jt400Component* (*connection= Pool* URI parameter), an unnecessary connection is opened to an AS400 syste= m nevertheless. This happens only when the *resolvePropertyPlaceholders* pr= operty is set to *true* (there are getters called by reflection at some poi= nt from *IntrospectionSupport* class). This connection will never be used when using a custom *AS400ConnectionPool= *, as the *createEndpoint* method in Jt400Component class checks if we use = custom or default pool: {code:java} @Override protected Endpoint createEndpoint(String uri, String remaining, Map properties) throws Exception { AS400ConnectionPool connectionPool; if (properties.containsKey(CONNECTION_POOL)) { LOG.trace("AS400ConnectionPool instance specified in the URI - will= look it up."); =20 // We have chosen to handle the connectionPool option ourselves, so // we must remove it from the given parameter list (see // http://camel.apache.org/writing-components.html) String poolId =3D properties.remove(CONNECTION_POOL).toString(); connectionPool =3D EndpointHelper.resolveReferenceParameter(getCame= lContext(), poolId, AS400ConnectionPool.class, true); } else { LOG.trace("No AS400ConnectionPool instance specified in the URI - on= e will be provided."); connectionPool =3D getConnectionPool(); } String type =3D remaining.substring(remaining.lastIndexOf(".") + 1).toU= pperCase(); Jt400Endpoint endpoint =3D new Jt400Endpoint(uri, this, connectionPool)= ; setProperties(endpoint, properties); endpoint.setType(Jt400Type.valueOf(type)); return endpoint; } {code} and uses the one provided instead. I've attached a patch which changes behaviour of the *createEndpoint* metho= d to close the previously initialized default connection when the provided = one should be used instead. This is not a very elegant solution though. was: When using a custom *AS400ConnectionPool* for *Jt400Component* (*connection= Pool* URI parameter), an unnecessary connection is opened to an AS400 syste= m nevertheless. This happens only when the *resolvePropertyPlaceholders* pr= operty is set to *true* (there are getters called by reflection at some poi= nt from *IntrospectionSupport* class). This connection will never be used when using a custom *AS400ConnectionPool= *, as the *createEndpoint* method in Jt400Component class checks if we use = custom or default pool: {code:java} @Override protected Endpoint createEndpoint(String uri, String remaining, Map properties) throws Exception { AS400ConnectionPool connectionPool; if (properties.containsKey(CONNECTION_POOL)) { LOG.trace("AS400ConnectionPool instance specified in the URI - will= look it up."); =20 // We have chosen to handle the connectionPool option ourselves, so // we must remove it from the given parameter list (see // http://camel.apache.org/writing-components.html) String poolId =3D properties.remove(CONNECTION_POOL).toString(); connectionPool =3D EndpointHelper.resolveReferenceParameter(getCame= lContext(), poolId, AS400ConnectionPool.class, true); } else { LOG.trace("No AS400ConnectionPool instance specified in the URI - on= e will be provided."); connectionPool =3D getConnectionPool(); } String type =3D remaining.substring(remaining.lastIndexOf(".") + 1).toU= pperCase(); Jt400Endpoint endpoint =3D new Jt400Endpoint(uri, this, connectionPool)= ; setProperties(endpoint, properties); endpoint.setType(Jt400Type.valueOf(type)); return endpoint; } {code} and uses the one provided instead. I've attached a patch which changes behaviour of the *createEndpoint* metho= d to close the previously initialized default connection when the provided = one should be used instead. > Unnecessary connection opened when using custom AS400ConnectionPool > ------------------------------------------------------------------- > > Key: CAMEL-11590 > URL: https://issues.apache.org/jira/browse/CAMEL-11590 > Project: Camel > Issue Type: Bug > Components: camel-jt400 > Reporter: Rafa=C5=82 Ga=C5=82a > Priority: Minor > Attachments: Jt400Component.patch > > Original Estimate: 24h > Remaining Estimate: 24h > > When using a custom *AS400ConnectionPool* for *Jt400Component* (*connecti= onPool* URI parameter), an unnecessary connection is opened to an AS400 sys= tem nevertheless. This happens only when the *resolvePropertyPlaceholders* = property is set to *true* (there are getters called by reflection at some p= oint from *IntrospectionSupport* class). > This connection will never be used when using a custom *AS400ConnectionPo= ol*, as the *createEndpoint* method in Jt400Component class checks if we us= e custom or default pool: > {code:java} > @Override > protected Endpoint createEndpoint(String uri, String remaining, Map properties) throws Exception { > AS400ConnectionPool connectionPool; > if (properties.containsKey(CONNECTION_POOL)) { > LOG.trace("AS400ConnectionPool instance specified in the URI - wi= ll look it up."); > =20 > // We have chosen to handle the connectionPool option ourselves, = so > // we must remove it from the given parameter list (see > // http://camel.apache.org/writing-components.html) > String poolId =3D properties.remove(CONNECTION_POOL).toString(); > connectionPool =3D EndpointHelper.resolveReferenceParameter(getCa= melContext(), poolId, AS400ConnectionPool.class, true); > } else { > LOG.trace("No AS400ConnectionPool instance specified in the URI - = one will be provided."); > connectionPool =3D getConnectionPool(); > } > String type =3D remaining.substring(remaining.lastIndexOf(".") + 1).t= oUpperCase(); > Jt400Endpoint endpoint =3D new Jt400Endpoint(uri, this, connectionPoo= l); > setProperties(endpoint, properties); > endpoint.setType(Jt400Type.valueOf(type)); > return endpoint; > } > {code} > and uses the one provided instead. > I've attached a patch which changes behaviour of the *createEndpoint* met= hod to close the previously initialized default connection when the provide= d one should be used instead. This is not a very elegant solution though. -- This message was sent by Atlassian JIRA (v6.4.14#64029)