[ https://issues.apache.org/jira/browse/HADOOP-10826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14062404#comment-14062404 ]
Uma Maheswara Rao G commented on HADOOP-10826: ---------------------------------------------- As this is used in fsnamesystem initialization paths, and to avoid unnecessary synchronization in critical NN startup paths, how about we just mention in javadoc about thread unsafety now. When really usecase comes to use it in multi thread case, then user of this class will realize and change if needed? > Iteration on KeyProviderFactory.serviceLoader is thread-unsafe > --------------------------------------------------------------- > > Key: HADOOP-10826 > URL: https://issues.apache.org/jira/browse/HADOOP-10826 > Project: Hadoop Common > Issue Type: Improvement > Components: security > Reporter: Benoy Antony > Assignee: Benoy Antony > Attachments: HADOOP-10826.patch > > > KeyProviderFactory uses _ServiceLoader_ framework to load _KeyProviderFactory_ > {code} > private static final ServiceLoader<KeyProviderFactory> serviceLoader = > ServiceLoader.load(KeyProviderFactory.class); > {code} > The _ServiceLoader_ framework does lazy initialization of services which > makes it thread unsafe. If accessed from multiple threads, it is better to > synchronize the access. > Similar synchronization has been done while loading compression codec > providers via HADOOP-8406. -- This message was sent by Atlassian JIRA (v6.2#6252)