public static long getImmunityTime(String checkImmunityTimeStr, long transactionTimeout) {
        long checkImmunityTime = 0;

        try {
            checkImmunityTime = Long.parseLong(checkImmunityTimeStr) * 1000;
        } catch (Throwable ignored) {
        }

        //If a custom first check time is set, the minimum check time;
        //The default check protection period is transactionTimeout
        if (checkImmunityTime < transactionTimeout) {
            checkImmunityTime = transactionTimeout;
        }
        return checkImmunityTime;
    }
@Test
    public void testGetImmunityTime() {
        long transactionTimeout = 6 * 1000;

        String checkImmunityTimeStr = "1";
        long immunityTime = TransactionalMessageUtil.getImmunityTime(checkImmunityTimeStr, transactionTimeout);
        Assert.assertEquals(6 * 1000, immunityTime);

        checkImmunityTimeStr = "5";
        immunityTime = TransactionalMessageUtil.getImmunityTime(checkImmunityTimeStr, transactionTimeout);
        Assert.assertEquals(6 * 1000, immunityTime);

        checkImmunityTimeStr = "7";
        immunityTime = TransactionalMessageUtil.getImmunityTime(checkImmunityTimeStr, transactionTimeout);
        Assert.assertEquals(7 * 1000, immunityTime);


        checkImmunityTimeStr = null;
        immunityTime = TransactionalMessageUtil.getImmunityTime(checkImmunityTimeStr, transactionTimeout);
        Assert.assertEquals(6 * 1000, immunityTime);

        checkImmunityTimeStr = "-1";
        immunityTime = TransactionalMessageUtil.getImmunityTime(checkImmunityTimeStr, transactionTimeout);
        Assert.assertEquals(6 * 1000, immunityTime);

        checkImmunityTimeStr = "60";
        immunityTime = TransactionalMessageUtil.getImmunityTime(checkImmunityTimeStr, transactionTimeout);
        Assert.assertEquals(60 * 1000, immunityTime);

        checkImmunityTimeStr = "100";
        immunityTime = TransactionalMessageUtil.getImmunityTime(checkImmunityTimeStr, transactionTimeout);
        Assert.assertEquals(100 * 1000, immunityTime);


        checkImmunityTimeStr = "100.5";
        immunityTime = TransactionalMessageUtil.getImmunityTime(checkImmunityTimeStr, transactionTimeout);
        Assert.assertEquals(6 * 1000, immunityTime);
    }