On Tue, Nov 12, 2019 at 11:28 AM Jonathan Gallimore <
[email protected]> wrote:

> How are you validating that it didn't work?
>
The message was not displaying on the 2 minute mark, I see what you mean.

>
> Remember, exceeding the timeout will not interrupt the process. The
> rollback will also not happen at the 2 minute mark.
>
> What happens is, when the business method completes and the transaction
> goes to commit, the execution time is compared against the timeout, and
> rolled back if the execution has taken longer:
>
> https://github.com/apache/geronimo-txmanager/blob/geronimo-txmanager-parent-3.1.4/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java#L265
>
> Hm I see.


> Where you have a long-running process you need to consider where your
> transaction boundaries are.  Do you want everything to rollback if it takes
> 11 minutes instead of 10 to run - probably not. Without knowing what the
> process is, it's hard to make suggestions, but it sounds like some sort of
> batch process. Perhaps it needs to be broken up into smaller transactions.
>
> Correct it is a batch process, I will try to find out why the queries are
taking so long anyway and better it.

Thanks Jon.

> Jon
>
> On Tue, Nov 12, 2019 at 1:12 PM Ivan Junckes Filho <[email protected]>
> wrote:
>
> > I lowered the timeout value for 2 minutes, just to see if the timeout
> > worked, but it doesn't seem to work. Maybe it doesn't work less than 10
> > minutes?
> >
> > On Tue, Nov 12, 2019 at 9:59 AM Ivan Junckes Filho <
> [email protected]>
> > wrote:
> >
> > > I am actually running @Schedule process that executes some queries that
> > > take a long time and save the result in the db so they can be
> downloaded.
> > >
> > > I m not sure if there is a better way to do this, but 10 minutes may
> not
> > > be enough. I just didn't want the process to stop.
> > >
> > >
> > > On Tue, Nov 12, 2019 at 10:56 AM Jonathan Gallimore <
> > > [email protected]> wrote:
> > >
> > >> Right. You can't just "stop" a thread in Java. Your business method
> will
> > >> need some mechanism by which it would stop and return with an error or
> > >> similar if it didn't finish within a specific time, if that's what
> > you're
> > >> after.
> > >>
> > >> If you're changing the timeout to try and "fix" a problem, the root
> > cause
> > >> is probably somewhere else.
> > >>
> > >> Jon
> > >>
> > >> On Tue, Nov 12, 2019 at 12:46 PM Ivan Junckes Filho <
> > >> [email protected]>
> > >> wrote:
> > >>
> > >> > "but the operations themselves won't be interrupted at the
> > >> > timeout point." This is important, thanks Jon.
> > >> >
> > >> > On Tue, Nov 12, 2019 at 10:32 AM Jonathan Gallimore <
> > >> > [email protected]> wrote:
> > >> >
> > >> > > You'd need to define a TransactionManager, and set the
> > >> > > defaultTransactionTimeout on it, similar to this:
> > >> > >
> > >> > > <TransactionManager id="myTransactionManager"
> > >> type="TransactionManager">
> > >> > >     defaultTransactionTimeout = 10 minutes
> > >> > > </TransactionManager>
> > >> > >
> > >> > > Note that that bean invocations that exceed the timeout will be
> > >> marked as
> > >> > > rolled back, but the operations themselves won't be interrupted at
> > the
> > >> > > timeout point.
> > >> > >
> > >> > > Jon
> > >> > >
> > >> > >
> > >> > > On Tue, Nov 12, 2019 at 12:00 PM Ivan Junckes Filho <
> > >> > [email protected]
> > >> > > >
> > >> > > wrote:
> > >> > >
> > >> > > > Hey guys, quick question.
> > >> > > >
> > >> > > > What property should I use to change EJB transaction timeout?
> > >> > > > Does this work in the system.properties?
> > >> > > > defaultTransactionTimeout = 10 minutes
> > >> > > >
> > >> > >
> > >> >
> > >>
> > >
> >
>

Reply via email to