Thanks a lot for the clarification Scott Ferguson wrote: > On Apr 25, 2008, at 9:18 AM, Riccardo Cohen wrote: > >> all right, >> and what happens if 2 or 3 threads running the same code, call >> m_ut.Begin in the same time ? I suppose then that they all go in the >> same transaction ? > > No, each thread gets its own transaction. Transactions are always > thread-based. > > The UserTransaction object is thread-aware, so it automatically > handles each thread separately. > > -- Scott > >> >> Scott Ferguson wrote: >>> On Apr 25, 2008, at 5:29 AM, Riccardo Cohen wrote: >>> >>>> Thanks for this information. >>>> The member is static for now because it is the same transaction used >>>> in >>>> all servlets. >>> The UserTransaction is basically a singleton, so you can use @In >>> UserTransaction anywhere and it'll all become part of the same >>> transaction. One of the main points of transactions is that all of >>> your resources which commit together are in the same transaction, >>> i.e. >>> all-or-none commit. >>> >>> Normally, static is discouraged, though, as wesley said. >>> >>> -- Scott >>> >>>> Anyway most of my servlets have static only methods. >>>> >>>> wesley wrote: >>>>> Hi Riccardo, >>>>> >>>>> I'm using >>>>> @In >>>>> TransactionManager transaction; >>>>> in servlets and @Component >>>>> >>>>> and it proved to be robust and of good performance. >>>>> >>>>> ps> I don't think "static" is a good directive. >>>>> >>>>> -Wesley >>>>> >>>>> ----- Original Message ----- >>>>> From: "Riccardo Cohen" <[EMAIL PROTECTED]> >>>>> To: "General Discussion for the Resin application server" >>>>> <resin-interest@caucho.com> >>>>> Sent: Friday, April 25, 2008 4:31 PM >>>>> Subject: [Resin-interest] question about UserTransaction >>>>> >>>>> >>>>> Hi >>>>> I've learnt how to use UserTransaction, and even if it works, I >>>>> don't >>>>> know if my implementation has good performance. >>>>> >>>>> I added a single UserTransaction in one of my servlets : >>>>> >>>>> public class globalaction extends HttpServlet >>>>> { >>>>> @In public static UserTransaction m_ut; >>>>> >>>>> I use this m_ut from all servlets for all requests. Is this >>>>> safe ? Or >>>>> should I declare one UserTransaction in each servlet (or even one >>>>> for >>>>> each request ?) >>>>> >>>>> Thanks for any information >>>>> >>>> -- >>>> Très cordialement, >>>> >>>> Riccardo Cohen >>>> ------------------------------------------- >>>> Articque >>>> http://www.articque.com >>>> 149 av Général de Gaulle >>>> 37230 Fondettes - France >>>> tel : 02-47-49-90-49 >>>> fax : 02-47-49-91-49 >>>> >>>> >>>> >>>> _______________________________________________ >>>> resin-interest mailing list >>>> resin-interest@caucho.com >>>> http://maillist.caucho.com/mailman/listinfo/resin-interest >>> >>> >>> _______________________________________________ >>> resin-interest mailing list >>> resin-interest@caucho.com >>> http://maillist.caucho.com/mailman/listinfo/resin-interest >>> >> -- >> Très cordialement, >> >> Riccardo Cohen >> ------------------------------------------- >> Articque >> http://www.articque.com >> 149 av Général de Gaulle >> 37230 Fondettes - France >> tel : 02-47-49-90-49 >> fax : 02-47-49-91-49 >> >> >> >> _______________________________________________ >> resin-interest mailing list >> resin-interest@caucho.com >> http://maillist.caucho.com/mailman/listinfo/resin-interest > > > > _______________________________________________ > resin-interest mailing list > resin-interest@caucho.com > http://maillist.caucho.com/mailman/listinfo/resin-interest >
-- Très cordialement, Riccardo Cohen ------------------------------------------- Articque http://www.articque.com 149 av Général de Gaulle 37230 Fondettes - France tel : 02-47-49-90-49 fax : 02-47-49-91-49 _______________________________________________ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest