HADOOP-10732. Fix locking in credential update. (Ted Yu via omalley)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1611415 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Owen O'Malley 2014-07-17 17:45:12 +00:00
parent f4151bbf4f
commit 9aaa714a99
2 changed files with 8 additions and 3 deletions

View File

@ -158,9 +158,6 @@ Trunk (Unreleased)
HADOOP-10485. Remove dead classes in hadoop-streaming. (wheat9) HADOOP-10485. Remove dead classes in hadoop-streaming. (wheat9)
HADOOP-10607. Create API to separate credential/password storage from
applications. (Larry McCay via omalley)
HADOOP-10696. Add optional attributes to KeyProvider Options and Metadata. HADOOP-10696. Add optional attributes to KeyProvider Options and Metadata.
(tucu) (tucu)
@ -418,6 +415,11 @@ Release 2.6.0 - UNRELEASED
HADOOP-10839. Add unregisterSource() to MetricsSystem API. HADOOP-10839. Add unregisterSource() to MetricsSystem API.
(Shanyu Zhao via cnauroth) (Shanyu Zhao via cnauroth)
HADOOP-10607. Create an API to separate credentials/password storage
from applications (Larry McCay via omalley)
HADOOP-10732. Fix locking in credential update. (Ted Yu via omalley)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -230,6 +230,7 @@ public void deleteCredentialEntry(String name) throws IOException {
CredentialEntry innerSetCredential(String alias, char[] material) CredentialEntry innerSetCredential(String alias, char[] material)
throws IOException { throws IOException {
writeLock.lock();
try { try {
keyStore.setKeyEntry(alias, new SecretKeySpec( keyStore.setKeyEntry(alias, new SecretKeySpec(
new String(material).getBytes("UTF-8"), "AES"), new String(material).getBytes("UTF-8"), "AES"),
@ -237,6 +238,8 @@ CredentialEntry innerSetCredential(String alias, char[] material)
} catch (KeyStoreException e) { } catch (KeyStoreException e) {
throw new IOException("Can't store credential " + alias + " in " + this, throw new IOException("Can't store credential " + alias + " in " + this,
e); e);
} finally {
writeLock.unlock();
} }
changed = true; changed = true;
return new CredentialEntry(alias, material); return new CredentialEntry(alias, material);