From a74bc2c7c75b05d2dea87d829ab71798121e6175 Mon Sep 17 00:00:00 2001 From: Matt Burgess Date: Thu, 18 Aug 2016 13:21:15 -0400 Subject: [PATCH] NIFI-2598: This closes #889. Fixed issue with static init of properties in HiveConnectionPool --- .../nifi/dbcp/hive/HiveConnectionPool.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java index 9006d41ace..1784381e86 100644 --- a/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java +++ b/nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/dbcp/hive/HiveConnectionPool.java @@ -17,6 +17,7 @@ package org.apache.nifi.dbcp.hive; import java.io.File; + import org.apache.commons.dbcp.BasicDataSource; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.UserGroupInformation; @@ -51,6 +52,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; + import org.apache.nifi.controller.ControllerServiceInitializationContext; /** @@ -122,7 +124,7 @@ public class HiveConnectionPool extends AbstractControllerService implements Hiv private static final long TICKET_RENEWAL_PERIOD = 60000; - private final static List properties; + private List properties; private String connectionUrl = "unknown"; @@ -136,7 +138,8 @@ public class HiveConnectionPool extends AbstractControllerService implements Hiv private volatile File kerberosConfigFile = null; private volatile KerberosProperties kerberosProperties; - static { + @Override + protected void init(final ControllerServiceInitializationContext context) { List props = new ArrayList<>(); props.add(DATABASE_URL); props.add(HIVE_CONFIGURATION_RESOURCES); @@ -144,15 +147,12 @@ public class HiveConnectionPool extends AbstractControllerService implements Hiv props.add(DB_PASSWORD); props.add(MAX_WAIT_TIME); props.add(MAX_TOTAL_CONNECTIONS); - properties = props; - } - @Override - protected void init(final ControllerServiceInitializationContext context) { kerberosConfigFile = context.getKerberosConfigurationFile(); kerberosProperties = new KerberosProperties(kerberosConfigFile); - properties.add(kerberosProperties.getKerberosPrincipal()); - properties.add(kerberosProperties.getKerberosKeytab()); + props.add(kerberosProperties.getKerberosPrincipal()); + props.add(kerberosProperties.getKerberosKeytab()); + properties = props; } @Override