[jboss-jira] [JBoss JIRA] (WFLY-9955) Compatibility problem: allow a timeout value of "0" to be set

Amos Feng (JIRA) issues at jboss.org
Thu Mar 8 03:32:00 EST 2018


    [ https://issues.jboss.org/browse/WFLY-9955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13543217#comment-13543217 ] 

Amos Feng edited comment on WFLY-9955 at 3/8/18 3:31 AM:
---------------------------------------------------------

https://github.com/wildfly/wildfly/blob/master/transactions/src/main/java/org/jboss/as/txn/subsystem/TransactionSubsystemRootResourceDefinition.java#L494
{code}
            TxControl.setDefaultTimeout(resolvedValue.asInt());
            ContextTransactionManager.setGlobalDefaultTransactionTimeout(resolvedValue.asInt());
{code}

if the value == 0;
TxControl.setDefaultTimeout(0); // the transaction will be never time out. So it is OK to set zero here
ContextTransactionManager.setGlobalDefaultTransactionTimeout(0); // this is wrong, so it has to be converted to the maximum timeout  which might be Integer.MAX_VALUE

[~dmlloyd], I do not understand the necessary  to introduce a maximum timeout attribute. I suppose to change the above codes to 
{code}
            int timeoutValue = resolvedValue.asInt();
            TxControl.setDefaultTimeout(timeoutValue);
            if (timeoutValue == 0) {
                    timeoutValue = Integer.MAX_VALUE;
            }
            ContextTransactionManager.setGlobalDefaultTransactionTimeout(timeoutValue);
{code}


was (Author: zhfeng):
https://github.com/wildfly/wildfly/blob/master/transactions/src/main/java/org/jboss/as/txn/subsystem/TransactionSubsystemRootResourceDefinition.java#L494
{code}
            TxControl.setDefaultTimeout(resolvedValue.asInt());
            ContextTransactionManager.setGlobalDefaultTransactionTimeout(resolvedValue.asInt());
{code}

if the value == 0;
TxControl.setDefaultTimeout(0); // the transaction will be never time out. So it is OK to set zero here
ContextTransactionManager.setGlobalDefaultTransactionTimeout(0); // this is wrong, so it has to be converted to the maximum timeout  which might be Integer.MAX_VALUE

[~dmlloyd], I do not understand the necessary  to introduce a maximum timeout attribute. I suppose to change the above codes to 
{code}
            int timeoutValue = resolvedValue.asInt();
            TxControl.setDefaultTimeout(timeoutValue);
            if (timeoutValue > 0) {
                    timeoutValue = Integer.MAX_VALUE;
            }
            ContextTransactionManager.setGlobalDefaultTransactionTimeout(timeoutValue);
{code}

> Compatibility problem: allow a timeout value of "0" to be set
> -------------------------------------------------------------
>
>                 Key: WFLY-9955
>                 URL: https://issues.jboss.org/browse/WFLY-9955
>             Project: WildFly
>          Issue Type: Bug
>          Components: Transactions
>            Reporter: David Lloyd
>            Assignee: Amos Feng
>
> Previously we allowed a transaction timeout value of "0" to be set in the transaction subsystem, meaning "no transaction timeout".  After the WF 11 changes, we've stopped allowing that value to be set.  This behavior should be restored, with "0" translating into some "very large" value.
> The transaction team has indicated that using {{Integer.MAX_VALUE}} has historically exhibited problems, so a different, smaller-but-still-large value should be used in this case.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list