@ Override public boolean checkProgressRatio ( final double newWorkDone , final double totalWork , final double amountThreshold ) { double currentRatio ; synchronized ( this ) { // Compute the actual progression currentRatio = this . localWorkDone >= 0 ? 100 * this . localWorkDone / totalWork : 0.0 ; } // Compute the future progression final double newRatio = 100 * newWorkDone / totalWork ; // return true if the task has progressed of at least block increment value return newRatio - currentRatio > amountThreshold ; }
Check if the task has enough progressed according to the given threshold .