You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Armin Waibel <ar...@code-au-lait.de> on 2003/07/01 17:02:21 UTC

Re: LocalTxManager delete the only current Thread available ???

Hi again,

----- Original Message -----
From: "Emmanuel Dupont" <em...@jwaretechnologies.com>
To: "'OJB Users List'" <oj...@db.apache.org>; "'Armin Waibel'"
<ar...@code-au-lait.de>
Sent: Tuesday, July 01, 2003 10:14 AM
Subject: RE : LocalTxManager delete the only current Thread available
???


Hi Armin,

With the join() it works.


Does that means that I can only use inner transactions when I work with
multi-threading ? Or I all time have to use the join ()...?
#########
Think this has nothing to do with multi-threading. The problem is
that the ODMG implementation can't handle multiple tx (inner/nested tx)
of one thread at the same time. Thus you have to call join() to
re-register
a tx when an inner tx was used before.



I have some BusinessObjects who works directly with the JDO objects,
does
that means that I must have an instance variable in the mother class of
my
business objects, because I don't use multi threading and so, I only
will
have only one thread, so the transaction is an instance variable....?
########
Sorry, I don't understand what you mean.

regards,
Armin

Thanks again for your replies Armin !




-----Message d'origine-----
De : Armin Waibel [mailto:armin@code-au-lait.de]
Envoyé : lundi 30 juin 2003 18:12
À : OJB Users List
Objet : Re: LocalTxManager delete the only current Thread available ???

Hi,

per thread you only can perform one transaction. Currently nested
tx are not supported.
Do you have tried do a tx.join() call before the last
tx.lock(...) method call?

regards,
Armin

----- Original Message -----
From: "Emmanuel Dupont" <em...@jwaretechnologies.com>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Monday, June 30, 2003 4:24 PM
Subject: LocalTxManager delete the only current Thread available ???


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.













---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org






RsIterator question

Posted by Mykola Ostapchuk <my...@sympatico.ca>.
Hello,

I'm using  broker.getIteratorByQuery(query);  to return Iterator of all
Users in DB.
Then I pass this Iterator to JSP page (or Struts <logic:iterate tag) - and
as the result it displays nothing.
I'm not sure it's the problem with OJB, but - if I pass to JSP page
Iterator, created from a Collection - it works OK.
Maybe OJB's Iterator - RsIterator doesn't work this way?

By the way - is using broker.getIteratorByQuery() the best way to deal with
displaying big DB tables?

Regards,
Mykola Ostapchuk



RE : LocalTxManager delete the only current Thread available ???

Posted by Emmanuel Dupont <em...@jwaretechnologies.com>.
Armin,

Forget my BusinessObject literature.

I have another important question.

Can you confirm to me or not that the order of the lock are important. It
seems that when an object A as some FK of an object B, I have to lock B and
after A if I only set the FK_Id and not the reference association (setbB).

Do you advocate to use the reference association when you lock many objects
or do you advocate to order the different locks....I am in a recursive
treatment of a tree...

Tx !

-----Message d'origine-----
De : Armin Waibel [mailto:armin@code-au-lait.de] 
Envoyé : mardi 1 juillet 2003 17:02
À : OJB Users List
Objet : Re: LocalTxManager delete the only current Thread available ???

Hi again,

----- Original Message -----
From: "Emmanuel Dupont" <em...@jwaretechnologies.com>
To: "'OJB Users List'" <oj...@db.apache.org>; "'Armin Waibel'"
<ar...@code-au-lait.de>
Sent: Tuesday, July 01, 2003 10:14 AM
Subject: RE : LocalTxManager delete the only current Thread available
???


Hi Armin,

With the join() it works.


Does that means that I can only use inner transactions when I work with
multi-threading ? Or I all time have to use the join ()...?
#########
Think this has nothing to do with multi-threading. The problem is
that the ODMG implementation can't handle multiple tx (inner/nested tx)
of one thread at the same time. Thus you have to call join() to
re-register
a tx when an inner tx was used before.



I have some BusinessObjects who works directly with the JDO objects,
does
that means that I must have an instance variable in the mother class of
my
business objects, because I don't use multi threading and so, I only
will
have only one thread, so the transaction is an instance variable....?
########
Sorry, I don't understand what you mean.

regards,
Armin

Thanks again for your replies Armin !




-----Message d'origine-----
De : Armin Waibel [mailto:armin@code-au-lait.de]
Envoyé : lundi 30 juin 2003 18:12
À : OJB Users List
Objet : Re: LocalTxManager delete the only current Thread available ???

Hi,

per thread you only can perform one transaction. Currently nested
tx are not supported.
Do you have tried do a tx.join() call before the last
tx.lock(...) method call?

regards,
Armin

----- Original Message -----
From: "Emmanuel Dupont" <em...@jwaretechnologies.com>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Monday, June 30, 2003 4:24 PM
Subject: LocalTxManager delete the only current Thread available ???


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.













---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org






---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org