Java recursive return problem?

protected boolean getRunStatus() {
    Task task = taskMapper.getRunByRemark(AUTO_RUN_REMARK);
    if(task == null) {
        Task obj = new Task();
        obj.setRemark(AUTO_RUN_REMARK);
        obj.setRunStatus(2);
        int save = taskMapper.save(obj);
        getRunStatus();
    } else {
        Integer runStatus = task.getRunStatus();
        return runStatus == 1 ? true : false; //returngetRunStatus(),false
    }
    return false;
}
Jan.25,2022

returns

modify the code a little

protected void getRunStatus() {
    Task task = taskMapper.getRunByRemark(AUTO_RUN_REMARK);
    if(task == null) {
        Task obj = new Task();
        obj.setRemark(AUTO_RUN_REMARK);
        obj.setRunStatus(2);
        int save = taskMapper.save(obj);
        getRunStatus();
    } else {
        task.getRunStatus();
    }
}

if the task obtained by taskMapper.getRunByRemark is null, a new one is generated and stored in taskMapper, and then called recursively.
at this point, the code will be divided into else, and the program will return.

if the task obtained by taskMapper.getRunByRemark is not null, the program returns.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ead123-2127.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ead123-2127.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?