HADOOP-11122. Fix findbugs in ZK DelegationTokenSecretManagers. (Arun Suresh via kasha)
(cherry picked from commit 70719e5c62
)
This commit is contained in:
parent
3476b9630f
commit
b3bb4fdc7c
|
@ -652,6 +652,9 @@ Release 2.6.0 - UNRELEASED
|
|||
HADOOP-11175. Fix several issues of hadoop security configuration in user
|
||||
doc. (Yi Liu via cnauroth)
|
||||
|
||||
HADOOP-11122. Fix findbugs in ZK DelegationTokenSecretManagers.
|
||||
(Arun Suresh via kasha)
|
||||
|
||||
Release 2.5.1 - 2014-09-05
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -163,11 +163,6 @@ extends AbstractDelegationTokenIdentifier>
|
|||
return;
|
||||
}
|
||||
|
||||
// for ZK based secretManager
|
||||
protected void updateMasterKey(DelegationKey key) throws IOException{
|
||||
return;
|
||||
}
|
||||
|
||||
// RM
|
||||
protected void removeStoredMasterKey(DelegationKey key) {
|
||||
return;
|
||||
|
@ -191,7 +186,7 @@ extends AbstractDelegationTokenIdentifier>
|
|||
* For subclasses externalizing the storage, for example Zookeeper
|
||||
* based implementations
|
||||
*/
|
||||
protected int getDelegationTokenSeqNum() {
|
||||
protected synchronized int getDelegationTokenSeqNum() {
|
||||
return delegationTokenSequenceNumber;
|
||||
}
|
||||
|
||||
|
@ -199,7 +194,7 @@ extends AbstractDelegationTokenIdentifier>
|
|||
* For subclasses externalizing the storage, for example Zookeeper
|
||||
* based implementations
|
||||
*/
|
||||
protected int incrementDelegationTokenSeqNum() {
|
||||
protected synchronized int incrementDelegationTokenSeqNum() {
|
||||
return ++delegationTokenSequenceNumber;
|
||||
}
|
||||
|
||||
|
@ -207,7 +202,7 @@ extends AbstractDelegationTokenIdentifier>
|
|||
* For subclasses externalizing the storage, for example Zookeeper
|
||||
* based implementations
|
||||
*/
|
||||
protected void setDelegationTokenSeqNum(int seqNum) {
|
||||
protected synchronized void setDelegationTokenSeqNum(int seqNum) {
|
||||
delegationTokenSequenceNumber = seqNum;
|
||||
}
|
||||
|
||||
|
@ -234,7 +229,6 @@ extends AbstractDelegationTokenIdentifier>
|
|||
*/
|
||||
protected void updateDelegationKey(DelegationKey key) throws IOException {
|
||||
allKeys.put(key.getKeyId(), key);
|
||||
updateMasterKey(key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -276,7 +276,7 @@ public abstract class ZKDelegationTokenSecretManager<TokenIdent extends Abstract
|
|||
}
|
||||
|
||||
@Override
|
||||
public void startThreads() throws IOException {
|
||||
public synchronized void startThreads() throws IOException {
|
||||
if (!isExternalClient) {
|
||||
try {
|
||||
zkClient.start();
|
||||
|
@ -402,7 +402,7 @@ public abstract class ZKDelegationTokenSecretManager<TokenIdent extends Abstract
|
|||
}
|
||||
|
||||
@Override
|
||||
public void stopThreads() {
|
||||
public synchronized void stopThreads() {
|
||||
try {
|
||||
if (!isExternalClient && (zkClient != null)) {
|
||||
zkClient.close();
|
||||
|
@ -434,12 +434,12 @@ public abstract class ZKDelegationTokenSecretManager<TokenIdent extends Abstract
|
|||
}
|
||||
|
||||
@Override
|
||||
protected int getDelegationTokenSeqNum() {
|
||||
protected synchronized int getDelegationTokenSeqNum() {
|
||||
return seqCounter.getCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int incrementDelegationTokenSeqNum() {
|
||||
protected synchronized int incrementDelegationTokenSeqNum() {
|
||||
try {
|
||||
while (!seqCounter.trySetCount(seqCounter.getCount() + 1)) {
|
||||
}
|
||||
|
@ -450,8 +450,12 @@ public abstract class ZKDelegationTokenSecretManager<TokenIdent extends Abstract
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void setDelegationTokenSeqNum(int seqNum) {
|
||||
delegationTokenSequenceNumber = seqNum;
|
||||
protected synchronized void setDelegationTokenSeqNum(int seqNum) {
|
||||
try {
|
||||
seqCounter.setCount(seqNum);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not set shared counter !!", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue