Quoting Georg Hicker <[EMAIL PROTECTED]>:

Hello,

> Hi!
> 
> Me and Hannes just analyzed the code and found the following code in 
> TransactionManagerImpl:
> |01    public void commit() throws RemoteException {
> 02        TransactionImpl tx = getTransaction();
> 03        if (tx == null)
> 04            throw new IllegalStateException();
> 05        forget();
> 06        tx.commit();
> 07    }
> |
> and the commit method in TransactionImpl looks like:
> |01    public void commit() throws RemoteException {
> 02        TransactionManagerImpl tm = TransactionManagerImpl.getInstance();
> 03        TransactionImpl tx = tm.suspend();
> 04
> 05        if (!canInitiateCompletion)
> 06            register();
> 07
> 08        try {
> 09            synchronized (callback) {
> 10                if (!committed) {
> 11                    if (aborted)
> 12                        throw new IllegalStateException();
> 13                    getCompletionCoordinatorStub().commitOperation(null);
> 14                    callback.wait();
> 15                }
> 16            }
> 17            if (timedOut)
> 18                throw new TimedOutException();
> 19            if (!committed)
> 20                throw new RollbackException();
> 21        } catch (RemoteException e) {
> 22            throw e;
> 23        } catch (Exception e) {
> 24            e.printStackTrace();
> 25            throw new RuntimeException(e);
> 26        } finally {
> 27            tm.resume(tx);
> 28        }
> 29    }
> |
> We wondered why the call for forget, where the TransactionImpl is 
> removed from the local variable threadInfo is called twice. If it is 
> called as shown above in line 05 of commit in the 
> TransactionManagerImpl, then tm.suspend() in line 03 of commit in 
> TransactionImpl can never return a TransactionImpl, because this one has 
> already been removed through calling forget(). Moreover line 27 of TI 
> can never resume any TI since it is always null.

a tx can be terminated in 2 ways: using the tx object and using the tm. in the
latter case it is the current tx but in the former it could be any tx. the
resume is there so that termination operation of a tx, does not come under the
current tx-- if any. there is a bug here, we need to check whethere the tx is
null before we resume it in line 27. please send in a patch. thanks a lot.

> 
> Is this your aim? If so why this way?
> 
> I tried to remove line 05 of TMI but this brought 
> java.lang.IllegalStateException in some TestSuite1-test cases.

> 
> Best regards,
>    Georg
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to