camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rafał Gała (JIRA) <j...@apache.org>
Subject [jira] [Updated] (CAMEL-11590) Unnecessary connection opened when using custom AS400ConnectionPool
Date Mon, 24 Jul 2017 12:04:00 GMT

     [ https://issues.apache.org/jira/browse/CAMEL-11590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rafał Gała updated CAMEL-11590:
-------------------------------
    Estimated Complexity:   (was: Unknown)

> 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ł Gała
>            Priority: Minor
>         Attachments: Jt400Component.patch
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> When using a custom *AS400ConnectionPool* for *Jt400Component* (*connectionPool* URI
parameter), an unnecessary connection is opened to an AS400 system nevertheless. This happens
only when the *resolvePropertyPlaceholders* property is set to *true* (there are getters called
by reflection at some point 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<String, Object>
properties) throws Exception {
>     AS400ConnectionPool connectionPool;
>     if (properties.containsKey(CONNECTION_POOL)) {
>         LOG.trace("AS400ConnectionPool instance specified in the URI - will look it up.");
>          
>         // 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 = properties.remove(CONNECTION_POOL).toString();
>         connectionPool = EndpointHelper.resolveReferenceParameter(getCamelContext(),
poolId, AS400ConnectionPool.class, true);
>     } else {
>        LOG.trace("No AS400ConnectionPool instance specified in the URI - one will be
provided.");
>        connectionPool = getConnectionPool();
>     }
>     String type = remaining.substring(remaining.lastIndexOf(".") + 1).toUpperCase();
>     Jt400Endpoint endpoint = 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* method to close
the previously initialized default connection when the provided one should be used instead.
This is not a very elegant solution though.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message