HHH-9482 - Avoid automatic timing out when requested timeout is 1 second
Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
parent
f8c0df8724
commit
30afa87434
|
@ -257,11 +257,11 @@ public class JdbcCoordinatorImpl implements JdbcCoordinator {
|
||||||
if ( transactionTimeOutInstant < 0 ) {
|
if ( transactionTimeOutInstant < 0 ) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
final int secondsRemaining = (int) ((transactionTimeOutInstant - System.currentTimeMillis()) / 1000);
|
final long millisecondsRemaining = transactionTimeOutInstant - System.currentTimeMillis();
|
||||||
if ( secondsRemaining <= 0 ) {
|
if ( millisecondsRemaining <= 0L ) {
|
||||||
throw new TransactionException( "transaction timeout expired" );
|
throw new TransactionException( "transaction timeout expired" );
|
||||||
}
|
}
|
||||||
return secondsRemaining;
|
return Math.max( (int) (millisecondsRemaining / 1000), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue