[jboss-cvs] JBossCache/src/org/jboss/cache/loader ...
Manik Surtani
manik at jboss.org
Fri Jun 29 06:27:02 EDT 2007
User: msurtani
Date: 07/06/29 06:27:02
Modified: src/org/jboss/cache/loader AdjListJDBCCacheLoader.java
Log:
Thread safety on get and exists
Revision Changes Path
1.7 +21 -5 JBossCache/src/org/jboss/cache/loader/AdjListJDBCCacheLoader.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AdjListJDBCCacheLoader.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/AdjListJDBCCacheLoader.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- AdjListJDBCCacheLoader.java 19 Jun 2007 10:45:42 -0000 1.6
+++ AdjListJDBCCacheLoader.java 29 Jun 2007 10:27:02 -0000 1.7
@@ -91,9 +91,17 @@
*/
public Map get(Fqn name) throws Exception
{
+ lock.acquireLock(name, false);
+ try
+ {
final Map node = loadNode(name);
return node == NULL_NODE_IN_ROW ? new HashMap(0) : node;
}
+ finally
+ {
+ lock.releaseLock(name);
+ }
+ }
/**
* Fetches child node names (not pathes).
@@ -299,9 +307,17 @@
*/
public boolean exists(Fqn name) throws Exception
{
+ lock.acquireLock(name, false);
+ try
+ {
final Map node = loadNode(name);
return node != null;// && node != NULL_NODE_IN_ROW;
}
+ finally
+ {
+ lock.releaseLock(name);
+ }
+ }
/**
* Removes attribute's value for a key. If after removal the node contains no attributes, the node is nullified.
More information about the jboss-cvs-commits
mailing list