[ 
https://issues.apache.org/jira/browse/NIFI-5790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16678725#comment-16678725
 ] 

ASF GitHub Bot commented on NIFI-5790:
--------------------------------------

Github user colindean commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/3133#discussion_r231660071
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-services/nifi-dbcp-service-bundle/nifi-dbcp-service/src/main/java/org/apache/nifi/dbcp/DBCPConnectionPool.java
 ---
    @@ -164,6 +164,71 @@ public ValidationResult validate(final String subject, 
final String input, final
             
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .build();
     
    +    public static final PropertyDescriptor MIN_IDLE = new 
PropertyDescriptor.Builder()
    +            .displayName("Minimum Idle Connections")
    +            .name("dbcp-mim-idle-conns")
    +            .description("The minimum number of connections that can 
remain idle in the pool, without extra ones being " +
    +                    "created, or zero to create none.")
    +            .defaultValue("0")
    +            .required(true)
    +            .addValidator(StandardValidators.INTEGER_VALIDATOR)
    +            .build();
    +
    +    public static final PropertyDescriptor MAX_IDLE = new 
PropertyDescriptor.Builder()
    +            .displayName("Max Idle Connections")
    +            .name("dbcp-max-idle-conns")
    +            .description("The maximum number of connections that can 
remain idle in the pool, without extra ones being " +
    +                    "released, or negative for no limit.")
    +            .defaultValue("8")
    +            .required(true)
    +            .addValidator(StandardValidators.INTEGER_VALIDATOR)
    +            .build();
    +
    +    public static final PropertyDescriptor MAX_CONN_LIFETIME = new 
PropertyDescriptor.Builder()
    +            .displayName("Max Connection Lifetime")
    +            .name("dbcp-max-conn-lifetime")
    +            .description("The maximum lifetime in milliseconds of a 
connection. After this time is exceeded the " +
    +                    "connection will fail the next activation, passivation 
or validation test. A value of zero or less " +
    +                    "means the connection has an infinite lifetime.")
    +            .defaultValue("-1")
    --- End diff --
    
    Looking into it, `NONNEGATIVE_INTEGER_VALIDATOR` lacks the custom time 
period validation. The new time period options should continue to use the 
`CUSTOM_TIME_PERIOD_VALIDATOR` defined in this class but I'll change `MIN_IDLE` 
to use `NONNEGATIVE_INTEGER_VALIDATOR`.  `MAX_IDLE` needs to stay 
`INTEGER_VALIDATOR` because 0 is a valid value for it.


> DBCPConnectionPool configuration should expose underlying connection idle and 
> eviction configuration
> ----------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-5790
>                 URL: https://issues.apache.org/jira/browse/NIFI-5790
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Extensions
>    Affects Versions: 1.8.0
>            Reporter: Colin Dean
>            Priority: Major
>              Labels: DBCP, database
>
> While investigating a fix for NIFI-5789, I noticed in the [DBCPConnectionPool 
> documentation|https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-dbcp-service-nar/1.8.0/org.apache.nifi.dbcp.DBCPConnectionPool/index.html]
>  that NiFi appears _not_ to have controller service configuration options 
> associated with [Apache 
> Commons-DBCP|https://commons.apache.org/proper/commons-dbcp/configuration.html]
>  {{BasicDataSource}} parameters like {{minIdle}} and {{maxIdle}}, which I 
> think should be both set to 0 in my particular use case. 
> Alternatively, I think I could set {{maxConnLifetimeMillis}} to something 
> even in the minutes range and satisfy my use case (a connection need not be 
> released _immediately_ but within a reasonable period of time), but this 
> option is also not available.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to