[ 
https://issues.apache.org/jira/browse/JCR-769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12478761
 ] 

Claus Köll commented on JCR-769:
--------------------------------

As explained in the comment before the first XASession tolds the 
TransactionContext to prepare all its
XA Resources. So one of this Resources is the InternalXAResource of the 
XAWorkspace (getXAResourceBegin()).
This Resource creates a lock on the WorkspaceInfo Object in the prepare Method.
So a lock has been acquired.
The second XASession has also its XAResources and also the InternalXAResource 
of the XAWorkspace.
So if the second Session tries to prepare the InternalXAResource a lock is 
already on the WorkspaceInfo until
a Rollback occurs.
I have fixed this problem.
I have a boolean value in the WorkspaceInfo that holds the information if a 
lock was previous has been acquired.
because the Mutex has no Method to get the information if a lock has been 
acquired before.
This fix works fine for me.
Are there any thoughts for this fix strategy ?

> Unable to login with two different Credentials to same workspace in one 
> Transaction
> -----------------------------------------------------------------------------------
>
>                 Key: JCR-769
>                 URL: https://issues.apache.org/jira/browse/JCR-769
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jca
>    Affects Versions: 1.2.1
>         Environment: Websphere 5.1.1 J2C Adapter
>            Reporter: Claus Köll
>         Attachments: stacktrace.txt
>
>
> I'm using the Jackrabbit 1.2.1 JCA adapter and trying to access in a 
> SessionBean-Method with Container Transaction a Workspace with 2 different 
> Credentials. 
> The Method takes about 400ms to finish but no commit on TransactionContextr 
> occurs (Debugging ..) only the prepare was called 2 times .
> The Container hangs on the PostInvoke Method about 5 seconds and then i get a 
> "javax.transaction.xa.XAException" 
> with the Warn Message: Transaction rolled back because timeout expired
> The code ..
> Context ctx = new InitialContext(); 
> Repository repository = (Repository) ctx.lookup("java:comp/env/jackrabbit"); 
> Credentials credentials = new SimpleCredentials("user1", 
> "password1".toCharArray()); 
> Credentials credentials2 = new SimpleCredentials("user2", 
> "password2".toCharArray()); 
> Session session1 = repository.login(credentials, "default"); 
> Session session2 = repository.login(credentials2, "default"); 
> Session1 adds a node to the workspace .. and with the session2 i do nothing 
> except the login !
> If i make no second login the Method works fine.

-- 
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