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

    https://github.com/apache/storm/pull/1064#discussion_r52486706
  
    --- Diff: 
external/storm-hbase/src/main/java/org/apache/storm/hbase/security/HBaseSecurityUtil.java
 ---
    @@ -39,26 +39,34 @@
     
         public static final String STORM_KEYTAB_FILE_KEY = "storm.keytab.file";
         public static final String STORM_USER_NAME_KEY = 
"storm.kerberos.principal";
    +    private static  UserProvider legacyProvider = null;
     
         public static UserProvider login(Map conf, Configuration hbaseConfig) 
throws IOException {
             //Allowing keytab based login for backward compatibility.
    -        UserProvider provider = UserProvider.instantiate(hbaseConfig);
    -        if (conf.get(TOPOLOGY_AUTO_CREDENTIALS) == null ||
    -                !(((List) 
conf.get(TOPOLOGY_AUTO_CREDENTIALS)).contains(AutoHBase.class.getName()))) {
    +        if (UserGroupInformation.isSecurityEnabled() && 
(conf.get(TOPOLOGY_AUTO_CREDENTIALS) == null ||
    +                !(((List) 
conf.get(TOPOLOGY_AUTO_CREDENTIALS)).contains(AutoHBase.class.getName())))) {
                 LOG.info("Logging in using keytab as AutoHBase is not 
specified for " + TOPOLOGY_AUTO_CREDENTIALS);
    -            if (UserGroupInformation.isSecurityEnabled()) {
    -                String keytab = (String) conf.get(STORM_KEYTAB_FILE_KEY);
    -                if (keytab != null) {
    -                    hbaseConfig.set(STORM_KEYTAB_FILE_KEY, keytab);
    +            //insure that if keytab is used only one login per process 
executed
    +            if(legacyProvider == null) {
    +                synchronized (HBaseSecurityUtil.class) {
    +                    if(legacyProvider == null) {
    --- End diff --
    
    There is a double check pattern here which locks on the class, the lock on 
the class will ensure that the legacy provider is instantiated and logged in 
only once per process


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to