public void start( int maxFailures ) { Preconditions.checkState( this.status.equals( Status.NOT_STARTED ) || this.status.equals( Status.FAILED ), "Attempted to start job in progress" ); this.status = Status.IN_PROGRESS; stats.incrementRuns(); // use >= in case the threshold lowers after the job has passed the failure // mark if ( maxFailures != FOREVER && stats.getTotalAttempts() > maxFailures ) { status = Status.DEAD; } startTime = System.currentTimeMillis(); stats.setStartTime( startTime ); }