Add method to let some lower-level actions try to generically update counts, but not to go lower than original counts were.

This commit is contained in:
2023-02-20 09:43:29 -06:00
parent 395f18f513
commit 5a6a0e2ac5
2 changed files with 49 additions and 0 deletions

View File

@ -95,6 +95,23 @@ public class AsyncJobCallback
/*******************************************************************************
** Update the current and total fields, but ONLY if the new values are
** both >= the previous values.
*******************************************************************************/
public void updateStatusOnlyUpwards(int current, int total)
{
boolean currentIsOkay = (this.asyncJobStatus.getCurrent() == null || this.asyncJobStatus.getCurrent() <= current);
boolean totalIsOkay = (this.asyncJobStatus.getTotal() == null || this.asyncJobStatus.getTotal() <= total);
if(currentIsOkay && totalIsOkay)
{
updateStatus(current, total);
}
}
/*******************************************************************************
** Increase the 'current' value in the '1 of 2' sense.
*******************************************************************************/