HADOOP-10831. UserProvider is not thread safe. (Benoy Antony via umamahesh)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1610789 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b60ef8b91b
commit
65b0cfc96b
@ -379,6 +379,8 @@ Trunk (Unreleased)
|
||||
NativeAzureFileSystem#NativeAzureFsInputStream#close().
|
||||
(Chen He via cnauroth)
|
||||
|
||||
HADOOP-10831. UserProvider is not thread safe. (Benoy Antony via umamahesh)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HADOOP-7761. Improve the performance of raw comparisons. (todd)
|
||||
|
@ -29,6 +29,8 @@
|
||||
* abstraction to separate credential storage from users of them. It
|
||||
* is intended to support getting or storing passwords in a variety of ways,
|
||||
* including third party bindings.
|
||||
*
|
||||
* <code>CredentialProvider</code> implementations must be thread safe.
|
||||
*/
|
||||
@InterfaceAudience.Public
|
||||
@InterfaceStability.Unstable
|
||||
|
@ -55,7 +55,7 @@ public boolean isTransient() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CredentialEntry getCredentialEntry(String alias) {
|
||||
public synchronized CredentialEntry getCredentialEntry(String alias) {
|
||||
byte[] bytes = credentials.getSecretKey(new Text(alias));
|
||||
if (bytes == null) {
|
||||
return null;
|
||||
@ -64,7 +64,7 @@ public CredentialEntry getCredentialEntry(String alias) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CredentialEntry createCredentialEntry(String name, char[] credential)
|
||||
public synchronized CredentialEntry createCredentialEntry(String name, char[] credential)
|
||||
throws IOException {
|
||||
Text nameT = new Text(name);
|
||||
if (credentials.getSecretKey(nameT) != null) {
|
||||
@ -77,7 +77,7 @@ public CredentialEntry createCredentialEntry(String name, char[] credential)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCredentialEntry(String name) throws IOException {
|
||||
public synchronized void deleteCredentialEntry(String name) throws IOException {
|
||||
byte[] cred = credentials.getSecretKey(new Text(name));
|
||||
if (cred != null) {
|
||||
credentials.removeSecretKey(new Text(name));
|
||||
@ -95,7 +95,7 @@ public String toString() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
public synchronized void flush() {
|
||||
user.addCredentials(credentials);
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ public CredentialProvider createProvider(URI providerName,
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAliases() throws IOException {
|
||||
public synchronized List<String> getAliases() throws IOException {
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<Text> aliases = credentials.getAllSecretKeys();
|
||||
for (Text key : aliases) {
|
||||
|
Loading…
Reference in New Issue
Block a user