You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by "Julian Feinauer (JIRA)" <ji...@apache.org> on 2019/07/25 14:40:00 UTC

[jira] [Created] (PLC4X-135) Allow the PooledPlcDriverManager to use a given PlcDriverManager as "base"

Julian Feinauer created PLC4X-135:
-------------------------------------

             Summary: Allow the PooledPlcDriverManager to use a given PlcDriverManager as "base"
                 Key: PLC4X-135
                 URL: https://issues.apache.org/jira/browse/PLC4X-135
             Project: Apache PLC4X
          Issue Type: New Feature
            Reporter: Julian Feinauer


Currently, the pool automatically creates a new Driver Manager (via a possibly given ClassLoader).
But it would be good to use a given one so that one can, e.g. use Monitoring or other Things on the Manager.

Reason is that we use Subclassing there instead of delegate, see


{code:java}
  private void setFromPoolCreator(PooledPlcDriverManager.PoolCreator poolCreator) {
    this.keyedObjectPool = poolCreator.createPool(new PooledPlcConnectionFactory() {
      public PlcConnection create(PoolKey key) throws Exception {
        PlcAuthentication plcAuthentication = key.plcAuthentication;
        String url = key.url;
        if (plcAuthentication == PooledPlcDriverManager.noPlcAuthentication) {
          PooledPlcDriverManager.LOGGER.debug("getting actual connection for {}", url);
          return PooledPlcDriverManager.super.getConnection(url);
        } else {
          PooledPlcDriverManager.LOGGER.debug("getting actual connection for {} and plcAuthentication {}", url, plcAuthentication);
          return PooledPlcDriverManager.super.getConnection(url, plcAuthentication);
        }
      }
    });
  }
{code}

from org.apache.plc4x.java.utils.connectionpool.PooledPlcDriverManager.java;




--
This message was sent by Atlassian JIRA
(v7.6.14#76016)