[ 
https://issues.apache.org/jira/browse/JCR-2428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Luiz Fernando Teston updated JCR-2428:
--------------------------------------

    Attachment: MultithreadedSessionTest.java

This test case shows the behavior described on this issue

> When adding nodes inside a given node on different sessions distributed on 
> different threads is throws InvalidItemStateException
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-2428
>                 URL: https://issues.apache.org/jira/browse/JCR-2428
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.6.0
>         Environment: Mac OS X 10.6 with JDK 1.5 (yes, I downgraded this)
>            Reporter: Luiz Fernando Teston
>         Attachments: MultithreadedSessionTest.java
>
>
> I just found an strange behavior while using multiple sessions on multi 
> thread environment. I'd like to know if I did something wrong. 
> My application code do this:
> 1 - before start to work, it creates a root node inside a new session. It 
> saves and close this session.
> 2 - create a bunch of workers. Each worker has its own session.
> 3 - each worker adds nodes inside the root node retrieved by its session. It 
> saves and do a logout properly.
> 4 - fill this workers on a list of Callables to be passed to an java 5 
> ThreadPoolExecutor.
> 5 - it executes all workers on the ThreadPool. 
> 6 - it do some asserts to verify if it gots some errors or not.
> During phase 5 it gots an exception telling this:
> javax.jcr.InvalidItemStateException: Item cannot be saved because it has been 
> modified externally: node /
>       at 
> org.apache.jackrabbit.core.ItemImpl.getTransientStates(ItemImpl.java:245)
>       at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:939)
>       at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:915)
> I just wrote a test to simulate this behavior. Sometimes it got this error 
> sometimes not. Also to be easy to simulate this error, just change the 
> THREAD_SIZE and NODE_SIZE variables.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to