exceptionfactory commented on a change in pull request #5259:
URL: https://github.com/apache/nifi/pull/5259#discussion_r681002615
##########
File path:
nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java
##########
@@ -426,4 +445,9 @@ public String getConnectionURL() {
boolean isAllowExplicitKeytab() {
return Boolean.parseBoolean(System.getenv(ALLOW_EXPLICIT_KEYTAB));
}
+
+ private Long extractMillisWithInfinite(PropertyValue prop) {
Review comment:
The return type of `Long` implies that the return can be `null`, but
`BasicDataSource.setMaxConnLifetimeMillis()` takes a primitive `long`. It would
be helpful to check for `null` from `asTimePeriod()` and handle the scenario,
then change this return type to `long`.
```suggestion
private long extractMillisWithInfinite(final PropertyValue prop) {
```
##########
File path:
nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java
##########
@@ -426,4 +445,9 @@ public String getConnectionURL() {
boolean isAllowExplicitKeytab() {
return Boolean.parseBoolean(System.getenv(ALLOW_EXPLICIT_KEYTAB));
}
+
+ private Long extractMillisWithInfinite(PropertyValue prop) {
+ return "-1".equals(prop.getValue()) ? -1 :
prop.asTimePeriod(TimeUnit.MILLISECONDS);
Review comment:
Rather than have special handling for `-1`, it seems better to delegate
all conversion to `asTimePeriod()` and set the default value to `0 s`. What do
you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]