@Romain

Seems like suspend/resume for the TransactionManager isnt available for all
app-servers (atleast not for the one we are still running some systems on
:)) so I guess I will stick to "wrapping" it in a NOT_SUPPORTED EJB call...

Thanks for the pointers...

Regards
LF

On Thu, May 7, 2015 at 3:38 PM, Romain Manni-Bucau <[email protected]>
wrote:

> that's a way but if you have the tx mgr you can also suspend the tx and
> resume it later
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-05-07 15:24 GMT+02:00 Lars-Fredrik Smedberg <[email protected]>:
>
> > @Romain, thanks for the code pointer, just had a look at it...
> >
> > And about suspending an ongoing tx, is the way I did it (through the
> > NOT_SUPPORTED EJB) the preferred way?
> >
> > Regards
> > LF
> >
> > On Thu, May 7, 2015 at 2:51 PM, Romain Manni-Bucau <
> [email protected]>
> > wrote:
> >
> > > Well javax.transaction.TransactionManager is portable, the jndi name is
> > not
> > > but should be easily configurable (or you can even try the 5-6 well
> known
> > > ones). You can check org.apache.openjpa.ee.AutomaticManagedRuntime for
> > this
> > > logic more or less
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <http://rmannibucau.wordpress.com> | Github <
> > > https://github.com/rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > <http://www.tomitribe.com>
> > >
> > > 2015-05-07 14:46 GMT+02:00 Lars-Fredrik Smedberg <[email protected]>:
> > >
> > > > @Romain
> > > >
> > > > I thought injecting the TransactionManager created non-portable code?
> > > >
> > > > Is there another way to actually suspend the ongoing transaction if
> > > > any....?
> > > >
> > > > Regards
> > > > LF
> > > >
> > > > On Thu, May 7, 2015 at 2:15 PM, Romain Manni-Bucau <
> > > [email protected]>
> > > > wrote:
> > > >
> > > > > Injecting the tx manager looks reasonable but ends up to more or
> less
> > > the
> > > > > same yes.
> > > > >  Le 7 mai 2015 13:27, "Lars-Fredrik Smedberg" <[email protected]>
> a
> > > > > écrit :
> > > > >
> > > > > > Hi
> > > > > >
> > > > > > What we need to do is to make sure that a specific code snippet
> not
> > > > runs
> > > > > in
> > > > > > a JTA tx....
> > > > > >
> > > > > > We want to do this in a portable way so what we do is the
> following
> > > > > (psuedo
> > > > > > code)
> > > > > >
> > > > > > @Resource
> > > > > > TransactionSynchronizationRegistry tsr;
> > > > > >
> > > > > > ....
> > > > > >
> > > > > > if (tsr.getTransactionStatus() == Status.STATUS_NO_TRANSACTION) {
> > > > > >     ....run code as is...
> > > > > > }
> > > > > > else {
> > > > > >    ... run code by passing it through an EJB with
> > > > > > @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
> which
> > > in
> > > > > turn
> > > > > > runs the actual code
> > > > > > }
> > > > > >
> > > > > > Is the above the simplest portable way of doing this in an JEE 6
> > > > > container?
> > > > > >
> > > > > > Any inputs would be great!
> > > > > >
> > > > > > Regards
> > > > > > LF
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Med vänlig hälsning / Best regards
> > > > > >
> > > > > > Lars-Fredrik Smedberg
> > > > > >
> > > > > > STATEMENT OF CONFIDENTIALITY:
> > > > > > The information contained in this electronic message and any
> > > > > > attachments to this message are intended for the exclusive use of
> > the
> > > > > > address(es) and may contain confidential or privileged
> information.
> > > If
> > > > > > you are not the intended recipient, please notify Lars-Fredrik
> > > Smedberg
> > > > > > immediately at [email protected], and destroy all copies of
> this
> > > > > > message and any attachments.
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Med vänlig hälsning / Best regards
> > > >
> > > > Lars-Fredrik Smedberg
> > > >
> > > > STATEMENT OF CONFIDENTIALITY:
> > > > The information contained in this electronic message and any
> > > > attachments to this message are intended for the exclusive use of the
> > > > address(es) and may contain confidential or privileged information.
> If
> > > > you are not the intended recipient, please notify Lars-Fredrik
> Smedberg
> > > > immediately at [email protected], and destroy all copies of this
> > > > message and any attachments.
> > > >
> > >
> >
> >
> >
> > --
> > Med vänlig hälsning / Best regards
> >
> > Lars-Fredrik Smedberg
> >
> > STATEMENT OF CONFIDENTIALITY:
> > The information contained in this electronic message and any
> > attachments to this message are intended for the exclusive use of the
> > address(es) and may contain confidential or privileged information. If
> > you are not the intended recipient, please notify Lars-Fredrik Smedberg
> > immediately at [email protected], and destroy all copies of this
> > message and any attachments.
> >
>



-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at [email protected], and destroy all copies of this
message and any attachments.

Reply via email to