jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r803505 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock: AbstractLockInfo.java LockImpl.java LockInfo.java LockManagerImpl.java XAEnvironment.java XALockImpl.java XALockManager.java
Date Wed, 12 Aug 2009 13:37:22 GMT
Author: jukka
Date: Wed Aug 12 13:37:21 2009
New Revision: 803505

URL: http://svn.apache.org/viewvc?rev=803505&view=rev
Log:
JCR-1590: JSR 283: Locking

Another code cleanup step: Use LockInfo instead of AbstractLockInfo when referring to lock
infos.

Perhaps we should simply make LockInfo an abstract class and merge the current AbstractLockInfo
into it? There doesn't seem to be much benefit in having a separate interface for code that's
only used within a single package.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/AbstractLockInfo.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockInfo.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XAEnvironment.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockManager.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/AbstractLockInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/AbstractLockInfo.java?rev=803505&r1=803504&r2=803505&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/AbstractLockInfo.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/AbstractLockInfo.java
Wed Aug 12 13:37:21 2009
@@ -157,8 +157,8 @@
      *
      * @return lock token
      */
-    public String getLockToken() {
-        return lockToken.toString();
+    public LockToken getLockToken() {
+        return lockToken;
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java?rev=803505&r1=803504&r2=803505&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockImpl.java
Wed Aug 12 13:37:21 2009
@@ -78,8 +78,8 @@
      * {@inheritDoc}
      */
     public String getLockToken() {
-        if (!info.isSessionScoped() || info.isLockHolder(node.getSession())) {
-            return info.getLockToken();
+        if (!info.isSessionScoped() && info.isLockHolder(node.getSession())) {
+            return info.getLockToken().toString();
         } else {
             return null;
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockInfo.java?rev=803505&r1=803504&r2=803505&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockInfo.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockInfo.java
Wed Aug 12 13:37:21 2009
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.core.lock;
 
+import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.id.NodeId;
 
 import javax.jcr.Session;
@@ -54,11 +55,25 @@
     public boolean isLockHolder(Session session);
 
     /**
+     * Return the session currently holding the lock
+     *
+     * @return session currently holding the lock
+     */
+    SessionImpl getLockHolder();
+
+    /**
+     * Set the session currently holding the lock
+     *
+     * @param lockHolder session currently holding the lock
+     */
+    void setLockHolder(SessionImpl lockHolder);
+
+    /**
      * Return the lock token associated with this lock.
      *
      * @return lock token
      */
-    public String getLockToken();
+    LockToken getLockToken();
 
     /**
      * Return a flag indicating whether the lock is live
@@ -68,6 +83,19 @@
     public boolean isLive();
 
     /**
+     * Set the live flag
+     * @param live live flag
+     */
+    void setLive(boolean live);
+
+    /**
+     * Return a flag indicating whether the lock information may still change.
+     *
+     * @return <code>true</code> if the lock is still alive.
+     */
+    boolean mayChange();
+
+    /**
      * Return a flag indicating whether the lock is session-scoped
      *
      * @return <code>true</code> if the lock is session-scoped;
@@ -81,4 +109,5 @@
      * @return number of seconds remaining until the lock expires.
      */
     public long getSecondsRemaining();
+
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java?rev=803505&r1=803504&r2=803505&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
Wed Aug 12 13:37:21 2009
@@ -89,8 +89,7 @@
     /**
      * Path map containing all locks at the leaves.
      */
-    private final PathMap<AbstractLockInfo> lockMap =
-        new PathMap<AbstractLockInfo>();
+    private final PathMap<LockInfo> lockMap = new PathMap<LockInfo>();
 
     private final ReentrantLock lockMapLock = new ReentrantLock(){
 
@@ -242,11 +241,11 @@
             return;
         }
 
-        final ArrayList<AbstractLockInfo> list = new ArrayList<AbstractLockInfo>();
+        final ArrayList<LockInfo> list = new ArrayList<LockInfo>();
 
-        lockMap.traverse(new PathMap.ElementVisitor<AbstractLockInfo>() {
-            public void elementVisited(PathMap.Element<AbstractLockInfo> element) {
-                AbstractLockInfo info = element.get();
+        lockMap.traverse(new PathMap.ElementVisitor<LockInfo>() {
+            public void elementVisited(PathMap.Element<LockInfo> element) {
+                LockInfo info = element.get();
                 if (!info.isSessionScoped()) {
                     list.add(info);
                 }
@@ -259,9 +258,8 @@
         try {
             writer = new BufferedWriter(
                     new OutputStreamWriter(locksFile.getOutputStream()));
-            for (int i = 0; i < list.size(); i++) {
-                AbstractLockInfo info = list.get(i);
-                writer.write(info.getLockToken());
+            for (LockInfo info : list) {
+                writer.write(info.getLockToken().toString());
                 writer.newLine();
             }
         } catch (FileSystemException fse) {
@@ -318,7 +316,7 @@
         try {
             // check whether node is already locked
             Path path = getPath(session, node.getId());
-            PathMap.Element<AbstractLockInfo> element = lockMap.map(path, false);
+            PathMap.Element<LockInfo> element = lockMap.map(path, false);
 
             LockInfo other = element.get();
             if (other != null) {
@@ -339,7 +337,8 @@
             info.setLive(true);
             session.addListener(info);
             if (!info.isSessionScoped()) {
-                getSessionLockManager(session).lockTokenAdded(info.getLockToken());
+                getSessionLockManager(session).lockTokenAdded(
+                        info.getLockToken().toString());
             }
             lockMap.put(path, info);
 
@@ -378,18 +377,19 @@
         try {
             SessionImpl session = (SessionImpl) node.getSession();
             // check whether node is locked by this session
-            PathMap.Element<AbstractLockInfo> element =
+            PathMap.Element<LockInfo> element =
                 lockMap.map(getPath(session, node.getId()), true);
             if (element == null) {
                 throw new LockException("Node not locked: " + node);
             }
-            AbstractLockInfo info = element.get();
+            LockInfo info = element.get();
             if (info == null) {
                 throw new LockException("Node not locked: " + node);
             }
             checkUnlock(info, session);
 
-            getSessionLockManager(session).lockTokenRemoved(info.getLockToken());
+            getSessionLockManager(session).lockTokenRemoved(
+                    info.getLockToken().toString());
 
             element.set(null);
             info.setLive(false);
@@ -409,17 +409,16 @@
     }
 
     /**
-     * Package-private low-level helper method returning all
-     * <code>AbstractLockInfo</code>s associated with the specified
-     * session.
+     * Package-private low-level helper method returning all locks
+     * associated with the specified session.
      * @param session session
      * @return an array of <code>AbstractLockInfo</code>s
      */
-    AbstractLockInfo[] getLockInfos(final SessionImpl session) {
-        final ArrayList<AbstractLockInfo> infos = new ArrayList<AbstractLockInfo>();
-        lockMap.traverse(new PathMap.ElementVisitor<AbstractLockInfo>() {
-            public void elementVisited(PathMap.Element<AbstractLockInfo> element) {
-                AbstractLockInfo info = element.get();
+    LockInfo[] getLockInfos(final SessionImpl session) {
+        final ArrayList<LockInfo> infos = new ArrayList<LockInfo>();
+        lockMap.traverse(new PathMap.ElementVisitor<LockInfo>() {
+            public void elementVisited(PathMap.Element<LockInfo> element) {
+                LockInfo info = element.get();
                 if (info.isLive() && info.isLockHolder(session)) {
                     infos.add(info);
                 }
@@ -435,7 +434,7 @@
      * @return lock info or <code>null</code> if node is not locked
      * @throws RepositoryException if an error occurs
      */
-    public AbstractLockInfo getLockInfo(NodeId id) throws RepositoryException {
+    public LockInfo getLockInfo(NodeId id) throws RepositoryException {
         Path path;
         try {
             path = getPath(sysSession, id);
@@ -445,8 +444,8 @@
 
         acquire();
         try {
-            PathMap.Element<AbstractLockInfo> element = lockMap.map(path, false);
-            AbstractLockInfo info = element.get();
+            PathMap.Element<LockInfo> element = lockMap.map(path, false);
+            LockInfo info = element.get();
             if (info != null) {
                 if (element.hasPath(path) || info.isDeep()) {
                     return info;
@@ -488,9 +487,9 @@
             SessionImpl session = (SessionImpl) node.getSession();
             Path path = getPath(session, node.getId());
 
-            PathMap.Element<AbstractLockInfo> element = lockMap.map(path, false);
-            AbstractLockInfo info = element.get();
-            if (info != null && (element.hasPath(path) || info.deep)) {
+            PathMap.Element<LockInfo> element = lockMap.map(path, false);
+            LockInfo info = element.get();
+            if (info != null && (element.hasPath(path) || info.isDeep())) {
                 NodeImpl lockHolder = (NodeImpl)
                     session.getItemManager().getItem(info.getId());
                 return new LockImpl(info, lockHolder);
@@ -511,7 +510,7 @@
 
         acquire();
 
-        AbstractLockInfo[] infos = getLockInfos(session);
+        LockInfo[] infos = getLockInfos(session);
 
         try {
             Lock[] locks = new Lock[infos.length];
@@ -546,7 +545,8 @@
 
         try {
             SessionImpl session = (SessionImpl) node.getSession();
-            PathMap.Element<AbstractLockInfo> element = lockMap.map(getPath(session,
node.getId()), true);
+            PathMap.Element<LockInfo> element =
+                lockMap.map(getPath(session, node.getId()), true);
             if (element == null) {
                 return false;
             }
@@ -568,15 +568,15 @@
             SessionImpl session = (SessionImpl) node.getSession();
             Path path = getPath(session, node.getId());
 
-            PathMap.Element<AbstractLockInfo> element = lockMap.map(path, false);
-            AbstractLockInfo info = element.get();
+            PathMap.Element<LockInfo> element = lockMap.map(path, false);
+            LockInfo info = element.get();
             if (info == null) {
                 return false;
             }
             if (element.hasPath(path)) {
                 return true;
             } else {
-                return info.deep;
+                return info.isDeep();
             }
         } catch (ItemNotFoundException e) {
             return false;
@@ -601,7 +601,7 @@
     public void checkLock(Path path, Session session)
             throws LockException, RepositoryException {
 
-        PathMap.Element<AbstractLockInfo> element = lockMap.map(path, false);
+        PathMap.Element<LockInfo> element = lockMap.map(path, false);
         LockInfo info = element.get();
         if (info != null) {
             if (element.hasPath(path) || info.isDeep()) {
@@ -637,12 +637,12 @@
             throws LockException, RepositoryException {
 
         // check whether node is locked by this session
-        PathMap.Element<AbstractLockInfo> element =
+        PathMap.Element<LockInfo> element =
             lockMap.map(getPath((SessionImpl) session, node.getId()), true);
         if (element == null) {
             throw new LockException("Node not locked: " + node);
         }
-        AbstractLockInfo info = element.get();
+        LockInfo info = element.get();
         if (info == null) {
             throw new LockException("Node not locked: " + node);
         }
@@ -679,10 +679,10 @@
 
             NodeImpl node = (NodeImpl)
                 this.sysSession.getItemManager().getItem(lockToken.getId());
-            PathMap.Element<AbstractLockInfo> element =
+            PathMap.Element<LockInfo> element =
                 lockMap.map(node.getPrimaryPath(), true);
             if (element != null) {
-                AbstractLockInfo info = element.get();
+                LockInfo info = element.get();
                 if (info != null) {
                     if (info.isLockHolder(session)) {
                         // nothing to do
@@ -718,10 +718,10 @@
 
             NodeImpl node = (NodeImpl) this.sysSession.getItemManager()
                     .getItem(lockToken.getId());
-            PathMap.Element<AbstractLockInfo> element =
+            PathMap.Element<LockInfo> element =
                 lockMap.map(node.getPrimaryPath(), true);
             if (element != null) {
-                AbstractLockInfo info = element.get();
+                LockInfo info = element.get();
                 if (info != null) {
                     if (info.isLockHolder(session)) {
                         info.setLockHolder(null);
@@ -1056,13 +1056,13 @@
      * Refresh a non-empty path element whose children might have changed
      * its position.
      */
-    private void refresh(PathMap.Element<AbstractLockInfo> element) {
-        final ArrayList<AbstractLockInfo> infos = new ArrayList<AbstractLockInfo>();
+    private void refresh(PathMap.Element<LockInfo> element) {
+        final ArrayList<LockInfo> infos = new ArrayList<LockInfo>();
         boolean needsSave = false;
 
         // save away non-empty children
-        element.traverse(new PathMap.ElementVisitor<AbstractLockInfo>() {
-            public void elementVisited(PathMap.Element<AbstractLockInfo> element) {
+        element.traverse(new PathMap.ElementVisitor<LockInfo>() {
+            public void elementVisited(PathMap.Element<LockInfo> element) {
                 infos.add(element.get());
             }
         }, false);
@@ -1073,7 +1073,7 @@
         // now re-insert at appropriate location or throw away if node
         // does no longer exist
         for (int i = 0; i < infos.size(); i++) {
-            AbstractLockInfo info = infos.get(i);
+            LockInfo info = infos.get(i);
             try {
                 NodeImpl node = (NodeImpl) sysSession.getItemManager().getItem(
                         info.getId());
@@ -1103,7 +1103,7 @@
         acquire();
 
         try {
-            PathMap.Element<AbstractLockInfo> parent =
+            PathMap.Element<LockInfo> parent =
                 lockMap.map(path.getAncestor(1), true);
             if (parent != null) {
                 refresh(parent);
@@ -1126,7 +1126,7 @@
         acquire();
 
         try {
-            PathMap.Element<AbstractLockInfo> parent =
+            PathMap.Element<LockInfo> parent =
                 lockMap.map(oldPath.getAncestor(1), true);
             if (parent != null) {
                 refresh(parent);
@@ -1148,7 +1148,7 @@
         acquire();
 
         try {
-            PathMap.Element<AbstractLockInfo> parent =
+            PathMap.Element<LockInfo> parent =
                 lockMap.map(path.getAncestor(1), true);
             if (parent != null) {
                 refresh(parent);
@@ -1229,7 +1229,7 @@
                         }
                     }
                 } else if (isLockHolder(session)) {
-                    session.removeLockToken(getLockToken());
+                    session.removeLockToken(getLockToken().toString());
                     setLockHolder(null);
                 }
             }
@@ -1282,11 +1282,11 @@
 
         try {
             Path path = getPath(sysSession, nodeId);
-            PathMap.Element<AbstractLockInfo> element = lockMap.map(path, true);
+            PathMap.Element<LockInfo> element = lockMap.map(path, true);
             if (element == null) {
                 throw new LockException("Node not locked: " + path.toString());
             }
-            AbstractLockInfo info = element.get();
+            LockInfo info = element.get();
             if (info == null) {
                 throw new LockException("Node not locked: " + path.toString());
             }
@@ -1306,8 +1306,8 @@
      * @param ps print stream to dump to
      */
     public void dump(final PrintStream ps) {
-        lockMap.traverse(new PathMap.ElementVisitor<AbstractLockInfo>() {
-            public void elementVisited(PathMap.Element<AbstractLockInfo> element) {
+        lockMap.traverse(new PathMap.ElementVisitor<LockInfo>() {
+            public void elementVisited(PathMap.Element<LockInfo> element) {
                 StringBuffer line = new StringBuffer();
                 for (int i = 0; i < element.getDepth(); i++) {
                     line.append("--");

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XAEnvironment.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XAEnvironment.java?rev=803505&r1=803504&r2=803505&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XAEnvironment.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XAEnvironment.java
Wed Aug 12 13:37:21 2009
@@ -108,7 +108,7 @@
      * @throws LockException if node is already locked
      * @throws RepositoryException if an error occurs
      */
-    public AbstractLockInfo lock(NodeImpl node, boolean isDeep, boolean isSessionScoped)
+    public LockInfo lock(NodeImpl node, boolean isDeep, boolean isSessionScoped)
             throws LockException, RepositoryException {
         return lock(node, isDeep, isSessionScoped, AbstractLockInfo.TIMEOUT_INFINITE, null);
     }
@@ -125,7 +125,7 @@
      * @throws LockException if node is already locked
      * @throws RepositoryException if an error occurs
      */
-    public AbstractLockInfo lock(NodeImpl node, boolean isDeep, boolean isSessionScoped,
long timeoutHint, String ownerInfo)
+    public LockInfo lock(NodeImpl node, boolean isDeep, boolean isSessionScoped, long timeoutHint,
String ownerInfo)
             throws LockException, RepositoryException {
 
         NodeId id = node.getNodeId();
@@ -170,7 +170,7 @@
         NodeId id = node.getNodeId();
 
         // check positive set first
-        AbstractLockInfo info = lockedNodesMap.get(id);
+        LockInfo info = lockedNodesMap.get(id);
         if (info != null) {
             lockedNodesMap.remove(id);
             operations.remove(info);
@@ -207,7 +207,7 @@
      * @return LockInfo lock info or <code>null</code> if node is not locked
      * @throws RepositoryException if an error occurs
      */
-    public AbstractLockInfo getLockInfo(NodeImpl node) throws RepositoryException {
+    public LockInfo getLockInfo(NodeImpl node) throws RepositoryException {
         NodeId id = node.getNodeId();
 
         // check negative set
@@ -237,21 +237,17 @@
     }
 
     /**
-     * Returns all <code>AbstractLockInfo</code>s associated with the specified
-     * session.
+     * Returns all locks associated with the specified session.
      * @param session session
-     * @return an array of <code>AbstractLockInfo</code>s
+     * @return locks associated with the session
      * @throws RepositoryException if an error occurs
      */
-    public AbstractLockInfo[] getLockInfos(SessionImpl session)
+    public LockInfo[] getLockInfos(SessionImpl session)
             throws RepositoryException {
-
-        ArrayList<AbstractLockInfo> result = new ArrayList<AbstractLockInfo>();
+        ArrayList<LockInfo> result = new ArrayList<LockInfo>();
 
         // get lock informations from global lock manager first
-        AbstractLockInfo[] infos = lockMgr.getLockInfos(session);
-        for (int i = 0; i < infos.length; i++) {
-            AbstractLockInfo info = infos[i];
+        for (LockInfo info : lockMgr.getLockInfos(session)) {
             // check negative set
             if (!unlockedNodesMap.containsKey(info.getId())) {
                 result.add(info);
@@ -261,7 +257,7 @@
         // add 'uncommitted' lock informations
         result.addAll(lockedNodesMap.values());
 
-        return (AbstractLockInfo[]) result.toArray(new AbstractLockInfo[result.size()]);
+        return (LockInfo[]) result.toArray(new LockInfo[result.size()]);
     }
 
     /**
@@ -274,7 +270,7 @@
         try {
             LockToken lockToken = LockToken.parse(lt);
             NodeImpl node = (NodeImpl) session.getItemManager().getItem(lockToken.getId());
-            AbstractLockInfo info = getLockInfo(node);
+            LockInfo info = getLockInfo(node);
             if (info != null) {
                 if (info.isLockHolder(session)) {
                     // nothing to do
@@ -306,7 +302,7 @@
             LockToken lockToken = LockToken.parse(lt);
 
             NodeImpl node = (NodeImpl) session.getItemManager().getItem(lockToken.getId());
-            AbstractLockInfo info = getLockInfo(node);
+            LockInfo info = getLockInfo(node);
             if (info != null) {
                 if (info.isLockHolder(session)) {
                     info.setLockHolder(null);
@@ -416,7 +412,7 @@
      * Return a flag indicating whether a lock info belongs to a different
      * XA environment.
      */
-    public boolean differentXAEnv(AbstractLockInfo info) {
+    public boolean differentXAEnv(LockInfo info) {
         if (info instanceof XALockInfo) {
             XALockInfo lockInfo = (XALockInfo) info;
             return lockInfo.getXAEnv() != this;
@@ -472,8 +468,9 @@
          * Create a new instance of this class. Used to signal an
          * unlock operation on some existing lock information.
          */
-        public XALockInfo(NodeImpl node, AbstractLockInfo info) {
-            super(info.lockToken, info.sessionScoped, info.deep, info.lockOwner, info.getSecondsRemaining());
+        public XALockInfo(NodeImpl node, LockInfo info) {
+            super(info.getLockToken(), info.isSessionScoped(), info.isDeep(),
+                    info.getLockOwner(), info.getSecondsRemaining());
 
             this.node = node;
             this.isUnlock = true;
@@ -495,8 +492,8 @@
             if (isUnlock) {
                 lockMgr.internalUnlock(node);
             } else {
-                AbstractLockInfo internalLock = lockMgr.internalLock(node, deep, sessionScoped,
getSecondsRemaining(), lockOwner);
-                AbstractLockInfo xaEnvLock = getLockInfo(node);
+                LockInfo internalLock = lockMgr.internalLock(node, deep, sessionScoped, getSecondsRemaining(),
lockOwner);
+                LockInfo xaEnvLock = getLockInfo(node);
                 // Check if the lockToken has been removed in the transaction ...
                 if (xaEnvLock != null && xaEnvLock.getLockHolder() == null) {
                     internalLock.setLockHolder(null);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockImpl.java?rev=803505&r1=803504&r2=803505&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockImpl.java
Wed Aug 12 13:37:21 2009
@@ -31,9 +31,9 @@
     private final XALockManager lockMgr;
     
     /**
-     * Abstract lock info.
+     * The underlying lock info.
      */
-    private final AbstractLockInfo info;
+    private final LockInfo info;
 
     /**
      * Create a new instance of this class.
@@ -41,7 +41,7 @@
      * @param node node holding lock
      */
     public XALockImpl(
-            XALockManager lockMgr, AbstractLockInfo info, NodeImpl node) {
+            XALockManager lockMgr, LockInfo info, NodeImpl node) {
         super(info, node);
 
         this.info = info;

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockManager.java?rev=803505&r1=803504&r2=803505&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/XALockManager.java
Wed Aug 12 13:37:21 2009
@@ -73,13 +73,13 @@
      */
     public Lock lock(NodeImpl node, boolean isDeep, boolean isSessionScoped, long timoutHint,
String ownerInfo)
             throws LockException, RepositoryException {
-        AbstractLockInfo info;
+        LockInfo info;
         if (isInXA()) {
             info = xaEnv.lock(node, isDeep, isSessionScoped, timoutHint, ownerInfo);
         } else {
             info = lockMgr.internalLock(node, isDeep, isSessionScoped, timoutHint, ownerInfo);
         }
-        lockMgr.writeLockProperties(node, info.lockOwner, info.deep);
+        lockMgr.writeLockProperties(node, info.getLockOwner(), info.isDeep());
         return new XALockImpl(this, info, node);
     }
 
@@ -87,7 +87,7 @@
      * {@inheritDoc}
      */
     public Lock getLock(NodeImpl node) throws LockException, RepositoryException {
-        AbstractLockInfo info;
+        LockInfo info;
         if (isInXA()) {
             info = xaEnv.getLockInfo(node);
         } else {
@@ -105,7 +105,7 @@
      * {@inheritDoc}
      */
     public Lock[] getLocks(SessionImpl session) throws RepositoryException {
-        AbstractLockInfo[] infos;
+        LockInfo[] infos;
         if (isInXA()) {
             infos = xaEnv.getLockInfos(session);
         } else {
@@ -115,7 +115,7 @@
         XALockImpl[] locks = new XALockImpl[infos.length];
 
         for (int i = 0; i < infos.length; i++) {
-            AbstractLockInfo info = infos[i];
+            LockInfo info = infos[i];
             NodeImpl holder = (NodeImpl) session.getItemManager().getItem(info.getId());
             locks[i] = new XALockImpl(this, info, holder);
         }
@@ -138,7 +138,7 @@
      * {@inheritDoc}
      */
     public boolean holdsLock(NodeImpl node) throws RepositoryException {
-        AbstractLockInfo info;
+        LockInfo info;
         if (isInXA()) {
             info = xaEnv.getLockInfo(node);
         } else {
@@ -151,7 +151,7 @@
      * {@inheritDoc}
      */
     public boolean isLocked(NodeImpl node) throws RepositoryException {
-        AbstractLockInfo info;
+        LockInfo info;
         if (isInXA()) {
             info = xaEnv.getLockInfo(node);
         } else {
@@ -164,7 +164,7 @@
      * {@inheritDoc}
      */
     public void checkLock(NodeImpl node) throws LockException, RepositoryException {
-        AbstractLockInfo info;
+        LockInfo info;
         if (isInXA()) {
             info = xaEnv.getLockInfo(node);
             if (info != null && !info.isLockHolder(node.getSession())) {
@@ -196,7 +196,7 @@
             throws LockException, RepositoryException {
 
         if (isInXA()) {
-            AbstractLockInfo info = xaEnv.getLockInfo(node);
+            LockInfo info = xaEnv.getLockInfo(node);
             if (info == null || !info.getId().equals(node.getId())) {
                 throw new LockException("Node not locked: " + node);
             }
@@ -297,7 +297,7 @@
      * Return a flag indicating whether a lock info belongs to a different
      * XA environment.
      */
-    public boolean differentXAEnv(AbstractLockInfo info) {
+    public boolean differentXAEnv(LockInfo info) {
         if (isInXA()) {
             return xaEnv.differentXAEnv(info);
         } else {



Mime
View raw message