Index: engine/src/main/java/org/hippoecm/repository/impl/WorkflowManagerImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- engine/src/main/java/org/hippoecm/repository/impl/WorkflowManagerImpl.java	(revision 36205)
+++ engine/src/main/java/org/hippoecm/repository/impl/WorkflowManagerImpl.java	(revision )
@@ -44,7 +44,6 @@
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.Value;
 import javax.jcr.ValueFormatException;
-import javax.jcr.lock.Lock;
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
@@ -517,7 +516,7 @@
              */
             synchronized (SessionDecorator.unwrap(rootSession)) {
                 documentManager.reset();
-                Workflow workflow = null; // compiler does not detect properly there is no path where this not set
+                Workflow workflow;
                 Class clazz = Class.forName(classname);
                 objectPersist = true;
                 Object object = documentManager.getObject(uuid, classname, types);
@@ -614,58 +613,10 @@
             rootSession.refresh(false);
 
             WorkflowPostActions postActions = null;
-            Node lockable = null;
             try {
                 targetMethod = upstream.getClass().getMethod(method.getName(), method.getParameterTypes());
                 synchronized (SessionDecorator.unwrap(rootSession)) {
                     postActions = WorkflowPostActionsImpl.createPostActions(WorkflowManagerImpl.this, category, targetMethod, uuid);
-                    try {
-                        if(!method.getName().equals("hints")) {
-                            lockable = rootSession.getNodeByIdentifier(uuid);
-                            if (lockable.isLocked()) {
-                                try {
-                                    Lock lock = lockable.getLock();
-                                    if(lock.isLockOwningSession()) {
-                                        lockable = null;
-                                    }
-                                } catch (LockException ex) {
-                                    // no longer locked
-                                }
-                            }
-                            if(!lockable.isNodeType("mix:lockable")) {
-                                lockable = lockable.getParent();
-                                if (lockable.isLocked()) {
-                                    try {
-                                        Lock lock = lockable.getLock();
-                                        if(lock.isLockOwningSession()) {
-                                            lockable = null;
-                                        }
-                                    } catch (LockException ex) {
-                                        // no longer locked
-                                    }
-                                }
-                            }
-                            if(lockable != null && !lockable.isNodeType("mix:lockable")) {
-                                lockable = null;
-                            }
-                        }
-                    } catch(ItemNotFoundException ex) {
-                        // if the item is not yet persisted, there is no need to try to lock it
-                        lockable = null;
-                    }
-                    if(lockable != null) {
-                        for (int retry=0; retry<12; retry++) {
-                            try {
-                                rootSession.getWorkspace().getLockManager().lock(lockable.getPath(), false, true, Long.MAX_VALUE, null);
-                                break;
-                            } catch (LockException ex) {
-                                try {
-                                    Thread.sleep(250);
-                                } catch(InterruptedException e) {
-                                }
-                            }
-                        }
-                    }
                     returnObject = targetMethod.invoke(upstream, args);
                     if (objectPersist && !targetMethod.getName().equals("hints")) {
                         documentManager.putObject(uuid, types, upstream);
@@ -746,17 +697,9 @@
                 } else {
                     log.info(new String(sb));
                 }
-                if(lockable != null) {
-                    rootSession.save();
-                    rootSession.refresh(false);
-                    try {
-                        rootSession.getWorkspace().getLockManager().unlock(lockable.getPath());
-                    } catch(LockException ex) {
-                    }
-                }
-            }
+            }
+        }
+    }
-        }
-    }
 
     private abstract class WorkflowChainHandler implements InvocationHandler {
         protected Node workflowNode;
@@ -922,7 +865,6 @@
 
         Object invoke(WorkflowManagerImpl manager) throws RepositoryException, WorkflowException {
             WorkflowPostActions postActions = null;
-            Node lockable = null;
             try {
                 Workflow workflow = null; // compiler does not detect properly there is no path where this not set
                 String classname = workflowNode.getProperty(HippoNodeType.HIPPO_CLASSNAME).getString();
@@ -982,29 +924,6 @@
 
                 Method targetMethod = workflow.getClass().getMethod(method.getName(), method.getParameterTypes());
                 synchronized (SessionDecorator.unwrap(manager.rootSession)) {
-                    if(!method.getName().equals("hints")) {
-                        try {
-                            lockable = manager.rootSession.getNodeByIdentifier(uuid);
-                            if (lockable.isLocked()) {
-                                try {
-                                    Lock lock = lockable.getLock();
-                                    if (lock.isLockOwningSession()) {
-                                        lockable = null;
-                                    }
-                                } catch (LockException ex) {
-                                    // no longer locked
-                                }
-                            }
-                            if (lockable != null && !lockable.isNodeType("mix:lockable")) {
-                                lockable = null;
-                            }
-                        } catch (ItemNotFoundException ex) {
-                            // if the item is not yet persisted, there is no need to try to lock it
-                        }
-                    }
-                    if(lockable != null) {
-                        manager.rootSession.getWorkspace().getLockManager().lock(lockable.getPath(), false, true, Long.MAX_VALUE, null);
-                    }
                     Object returnObject = targetMethod.invoke(workflow, arguments);
                     if (objectPersist && !targetMethod.getName().equals("hints")) {
                         manager.documentManager.putObject(uuid, types, workflow);
@@ -1070,9 +989,6 @@
                 log.debug(ex.getMessage(), ex);
                 throw ex;
             } finally {
-                if(lockable != null) {
-                    manager.rootSession.getWorkspace().getLockManager().lock(lockable.getPath(), false, true, Long.MAX_VALUE, null);
-                }
                 if (postActions != null) {
                     postActions.dispose();
                 }
