does BTM have solution of sharing transaction between multi threads

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

does BTM have solution of sharing transaction between multi threads

scarlettxu
We meet an scenario that works with multi thread.

In the main Thread, do some logic and update the database, in a point, it will call another service to update database, which is run in another Thread.

We want the two Threads share the same transaction, that means, either operation in either Thread fails, then the operation in another Thread will also be rolled back.

But work for several days, I found some posts say JTA does not support the multi Thread.

Is there any body know if BTM support the multi thread in one transaction? how to config it?
Reply | Threaded
Open this post in threaded view
|

Re: does BTM have solution of sharing transaction between multi threads

Ludovic Orban-2
The JTA spec explicitly forbids transactions to span across multiple threads. The only standard way around this is to suspend the transaction from a thread using Transaction.suspend() and resume it on another thread with Transaction.resume().

BTM doesn't provide any non-standard mechanism on this subject so if the simple suspend/resume mechanism doesn't fulfill your needs you'll have to start looking somewhere else as I know some other transaction managers do have some non-standard extensions in that exact area.



2011/8/5 scarlettxu <[hidden email]>

We meet an scenario that works with multi thread.

In the main Thread, do some logic and update the database, in a point, it
will call another service to update database, which is run in another
Thread.

We want the two Threads share the same transaction, that means, either
operation in either Thread fails, then the operation in another Thread will
also be rolled back.

But work for several days, I found some posts say JTA does not support the
multi Thread.

Is there any body know if BTM support the multi thread in one transaction?
how to config it?
--
View this message in context: http://old.nabble.com/does-BTM-have-solution-of-sharing-transaction-between-multi-threads-tp32199652p32199652.html
Sent from the Bitronix Transaction Manager mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: does BTM have solution of sharing transaction between multi threads

scarlettxu
Thanks very much!
I will try Transaction.suspend() Transaction.resume() first to see if it works.

Ludovic Orban-2 wrote
The JTA spec explicitly forbids transactions to span across multiple
threads. The only standard way around this is to suspend the transaction
from a thread using Transaction.suspend() and resume it on another thread
with Transaction.resume().

BTM doesn't provide any non-standard mechanism on this subject so if the
simple suspend/resume mechanism doesn't fulfill your needs you'll have to
start looking somewhere else as I know some other transaction managers do
have some non-standard extensions in that exact area.



2011/8/5 scarlettxu <xu_han_zi@163.com>

>
> We meet an scenario that works with multi thread.
>
> In the main Thread, do some logic and update the database, in a point, it
> will call another service to update database, which is run in another
> Thread.
>
> We want the two Threads share the same transaction, that means, either
> operation in either Thread fails, then the operation in another Thread will
> also be rolled back.
>
> But work for several days, I found some posts say JTA does not support the
> multi Thread.
>
> Is there any body know if BTM support the multi thread in one transaction?
> how to config it?
> --
> View this message in context:
> http://old.nabble.com/does-BTM-have-solution-of-sharing-transaction-between-multi-threads-tp32199652p32199652.html
> Sent from the Bitronix Transaction Manager mailing list archive at
> Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>