[ 
https://issues.apache.org/jira/browse/SLING-5582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15178359#comment-15178359
 ] 

Andreas Schaefer commented on SLING-5582:
-----------------------------------------

I cannot tell if it is working with Eclipse as I have no idea on how to make it 
work. I cannot upgrade to 1.0.10 and so I am stuck with 1.0.4 which is probably 
outdated and the project I am using to test is not accepted (missing jcr_root 
folder).

The session.save() call is made in the JcrCommand.execute() method at the end 
(see my code snippet above).

I don't know how to create a unit test as I don't understand what actually is 
going wrong (does the workflow delete old renditions and recreate them?). My 
guess is after that code inside the AddOrUpdateNodeCommand:
    private void update(ResourceProxy resource, Session session) throws 
RepositoryException, IOException {

        String path = resource.getPath();
        boolean nodeExists = session.nodeExists(path);

        Node node;
        if(nodeExists) {
            node = session.getNode(path);
            getLogger().trace("Found existing node at {0} with primaryType 
{1}", path, node.getPrimaryNodeType().getName());
        } else {
            node = createNode(resource, session);
            getLogger().trace("Created node at {0} with primaryType {1}", path, 
node.getPrimaryNodeType().getName());
        }

the workflow is deleting the old node and creates a new one and commits that 
before our command is through that is why we have an Item Already Exists 
exception. 

You might be able to force the failure on your end by adding a delay 
(Thread.sleep()) after that.

> DAM Updates fail due to race conditions with Workflows in AEM
> -------------------------------------------------------------
>
>                 Key: SLING-5582
>                 URL: https://issues.apache.org/jira/browse/SLING-5582
>             Project: Sling
>          Issue Type: Bug
>          Components: IDE
>    Affects Versions: Sling Eclipse IDE 1.0.10
>            Reporter: Andreas Schaefer
>             Fix For: Sling Eclipse IDE 1.1.2
>
>
> In my IntelliJ plugin an update of a DAM entry I sometimes run into an 
> exception while updating rendition files. This seems to be caused by the DAM 
> Workflows inside AEM which is triggered as soon as the original file is 
> updated. This is probably due to the fact that the "impl-vlt" code is 
> committing a change after each and every command and so the workflow is 
> triggered right away causing problems with the updates of the rendition files.
> I would think this is not just an issue of DAM assets but in general an issue 
> with any node that can trigger a workflow.
> From my point of view the plugin should be able to control the commits so 
> that a logical group like a DAM asset can be update in single step.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to