[exo-jcr-commits] exo-jcr SVN: r2283 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Apr 15 09:54:15 EDT 2010
Author: sergiykarpenko
Date: 2010-04-15 09:54:14 -0400 (Thu, 15 Apr 2010)
New Revision: 2283
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
Log:
EXOJCR-639: test to empty lock cache added in getLockData methods
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-04-15 12:04:21 UTC (rev 2282)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-04-15 13:54:14 UTC (rev 2283)
@@ -443,27 +443,11 @@
return lockTimeOut;
}
- private final LockActionNonTxAware<Integer, Object> getNumLocks = new LockActionNonTxAware<Integer, Object>()
- {
- public Integer execute(Object arg)
- {
- return cache.getChildrenNames(lockRoot).size();
- }
- };
-
@Managed
@ManagedDescription("The number of active locks")
public int getNumLocks()
{
- try
- {
- return executeLockActionNonTxAware(getNumLocks, null);
- }
- catch (LockException e)
- {
- // ignore me will never occur
- }
- return -1;
+ return ((CacheSPI<Serializable, Object>)cache).getNumberOfNodes() - 1;
}
/**
@@ -886,8 +870,11 @@
*/
public LockData getExactNodeOrCloseParentLock(NodeData node) throws RepositoryException
{
- if (node == null)
+
+ if (node == null || getNumLocks() == 0)
+ {
return null;
+ }
LockData retval = null;
retval = getLockDataById(node.getIdentifier());
if (retval == null)
@@ -906,12 +893,12 @@
*/
public LockData getExactNodeLock(NodeData node) throws RepositoryException
{
- LockData retval = null;
- if (node != null)
+ if (node == null || getNumLocks() == 0)
{
- retval = getLockDataById(node.getIdentifier());
+ return null;
}
- return retval;
+
+ return getLockDataById(node.getIdentifier());
}
/**
@@ -919,6 +906,11 @@
*/
public LockData getClosedChild(NodeData node) throws RepositoryException
{
+
+ if (node == null || getNumLocks() == 0)
+ {
+ return null;
+ }
LockData retval = null;
List<NodeData> childData = dataManager.getChildNodesData(node);
More information about the exo-jcr-commits
mailing list