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)

Reply via email to