Home

setTransactionTimeoutint

setTransactionTimeout(int) is a method in the Java Transaction API (JTA) used to configure the maximum duration allowed for transactions started by the current thread. The method is exposed by transaction management interfaces such as javax.transaction.TransactionManager and javax.transaction.UserTransaction.

Signature and parameters: void setTransactionTimeout(int seconds) throws SystemException. The parameter seconds represents the timeout in seconds.

Behavior: The method applies to the transaction context active on the calling thread. If the configured timeout

Usage considerations: Use setTransactionTimeout to bound long-running transactions, especially in systems with limited resources or strict

Exceptions: SystemException is thrown if the transaction manager cannot set the timeout or encounters an internal

See also: TransactionManager, UserTransaction, Java Transaction API (JTA), rollback.

The
value
is
typically
non-negative,
with
implementation-specific
rules
for
special
values.
For
example,
some
implementations
treat
0
as
disabling
the
timeout
or
as
selecting
a
default
timeout;
others
may
have
different
interpretations.
Always
consult
the
specific
transaction
manager’s
documentation
for
exact
semantics.
elapses
before
the
transaction
completes,
the
transaction
manager
may
roll
the
transaction
back
and
mark
resources
as
rollback-only.
This
can
affect
all
resources
participating
in
the
transaction,
potentially
triggering
rollback
exceptions
for
ongoing
operations.
SLAs.
It
is
common
to
set
the
timeout
before
starting
a
transaction
(before
begin)
and
to
choose
a
value
appropriate
for
the
typical
workload.
Changing
the
timeout
during
an
active
transaction
is
implementation-dependent
and
may
be
ignored
by
some
managers.
error.
Some
implementations
may
also
throw
IllegalArgumentException
for
invalid
values.