All
I think I found a bug or my implementation doesn't create thread properly.
Here is my code sample with ODMG API:
------------------------------------------------------
T1 = new Transaction();
T1.begin();
[...]
While (i<size) {
T2 = new Transaction();
T2.begin();
[...]
T2.commit();
}
ojb = new PObject();
T1.lock(obj, WRITE);
T1.commit();
----------------------------------------
It failed in the last lock with the message :
org.odmg.TransactionNotInProgressException: Calling method needed
transaction, but no transaction found for current thread :-(
at
org.apache.ojb.odmg.LocalTxManager.getCurrentTransaction(LocalTxManager.java
:46)
When I traced in Ojb code and I understand this processes:
In TransactionImpl the begin() do : txManager.registerTx(this);
The LocalTxManager call
registerTx(TransactionImpl tx) :
tx_table.put(Thread.currentThread(), tx);
It puts the current Thread in the tx_table (TransactionTable)
The trouble is on the commit off The T2 transaction:
The TransactionImpl 's commit call the doClose method and who call :
LocalTxManager : deregisterTx(Object token)
tx_table.remove(Thread.currentThread());
But the T2 transaction is attached to the same Thread as T1, so at the last
T2.commit() call the tx_table doesn't contains the current-Tread anymore !!!
And when T1 wants to work it failed !!
First question: Is it normal that T2 is on the same Thread as T1 ? So the
commit method, delete the Thread reference in the LocalTxManager 's
tx_table.
Second question What can I do ??
Any help whould be really appreciated.
Thanks a lot in advance!!
Emmanuel.