Author: keith
Date: Thu May 8 02:04:02 2008
New Revision: 16682
Log:
Applying patch given by nandana to Mashup-789
Modified:
trunk/wsas/java/modules/core/src/org/wso2/wsas/trust/SecurityTokenStore.java
Modified:
trunk/wsas/java/modules/core/src/org/wso2/wsas/trust/SecurityTokenStore.java
==============================================================================
---
trunk/wsas/java/modules/core/src/org/wso2/wsas/trust/SecurityTokenStore.java
(original)
+++
trunk/wsas/java/modules/core/src/org/wso2/wsas/trust/SecurityTokenStore.java
Thu May 8 02:04:02 2008
@@ -36,7 +36,14 @@
for (int i = 0; i < tokens.length; i++) {
SecurityTokenDO tokenDO = tokens[i];
Token token = tokenDO.toToken();
- super.tokens.put(token.getId(), token);
+
+ // Acquire the write lock before updating tokens
+ writeLock.lock();
+ try {
+ super.tokens.put(token.getId(), token);
+ } finally {
+ writeLock.unlock();
+ }
}
}
@@ -57,7 +64,14 @@
} catch (TokenAlreadyExistsException e) {
throw new TrustException("Token already exists", e);
}
- tokens.put(tokenId, token);
+
+ // Acquire the write lock before updating tokens
+ writeLock.lock();
+ try {
+ tokens.put(token.getId(), token);
+ } finally {
+ writeLock.unlock();
+ }
}
}
@@ -67,7 +81,14 @@
if (!this.tokens.keySet().contains(token.getId())) {
throw new TrustException("noTokenToUpdate", new
String[]{token.getId()});
}
- this.tokens.put(token.getId(), token);
+
+ // Acquire the write lock before updating tokens
+ writeLock.lock();
+ try {
+ this.tokens.put(token.getId(), token);
+ } finally {
+ writeLock.unlock();
+ }
SecurityTokenDO tokenDO = pm.getSecurityToken(token.getId());
tokenDO.update(token);
pm.updateSecurityToken(tokenDO);
_______________________________________________
Wsas-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev