Thanks Jan, Really good inputs and you definitely put me to the right direction, especially in regards to point 17.10, that taught me a lot! And yes, i see that my sample snippet is full of misleading errors, i was trying to make it simple but i think i over simplified it:S
Another correction to my earlier point. This is an issue to any workspace not just DAM. Nonetheless, i do think there is a bug when it comes to performing locks by public users see [i]"slightly"[/i] better code below: [code] Session sess = MgnlContext.getJCRSession("dam"); LockManager lock = sess.getWorkspace().getLockManager(); Node one = NodeUtil.createPath(sess.getRootNode(), "one", "mgnl:folder", true); //NOTE: MgnlContext.getJCRSession("dam").getUserID() will return null if session is instantiated by public user. //sess.toString() give something like session-123 for public users and session-admin-123 for superuser (im using this as a workaround, when getting null for getUserID()) String owner = StringUtils.defaultIfEmpty(sess.getUserID(), sess.toString()); lock.lock(one.getPath(), true, true, 5000, owner); sess.save(); //saving the lock that has just been applied Node two = NodeUtil.createPath(one, "two", "mgnl:folder"); sess.save(); //will EXPLODE here!!!!!! lock.unlock(one.getPath());[/code] As you can see in the code above i invoke the save() method which in turn invokes MgnlPropertySettingContentDecorator.save() in this save() method there is a line (line 498 if my decompiler is correct): [code] Session sysSession = MgnlContext.getSystemContext().getJCRSession(workspaceName);[/code] This line is the culprit, as it creates new session, also it creates the session as an admin, which looks something like "session-admin-123" My previously created session (sess) had a name of session-123, see the difference? Then this save() method attempts to modify my node "two" to apply pending changes such as creation date etc... However it attempts to apply those changes using new session (session-admin-123), but my node is locked by session-123. which is why i get the error posted in my first post, stating that the node is locked:( ------------------------------------------------------------- slight modification to my code such as [b]FROM[/b] Session sess = MgnlContext.getJCRSession("dam"); [b]TO[/b] Session sess = MgnlContext.getSystemContext().getJCRSession("dam"); solves the problem as my "sess" becomes session-admin-123, and later same session is retrieved by save() method..... but feels like a dirty workaround?... ------------------------------------------------------------- To answer your question why use locking? well we have multiple instances of public, and DAM workspace is in clustered repository (shared between publics). Our public users can add images, and we store them in DAM, so we use locking to assure that two users dont modify same node at once... Once again, thanks for your support, any help is always appreciated! Best, Ged -- Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=a3f1e0a0-8331-4a95-a4e8-e591880db620 ---------------------------------------------------------------- For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com> ----------------------------------------------------------------