public long getTimeWithoutImprovement(){
        // depends on status: synchronize with status updates
        synchronized(statusLock){
            if(status == SearchStatus.INITIALIZING){
                // initializing
                return JamesConstants.INVALID_TIME_SPAN;
            } else {
                // idle, running, terminating or disposed: check last improvement time
                if(lastImprovementTime == JamesConstants.INVALID_TIMESTAMP){
                    // no improvement made during current/last run, or did not yet run: equal to total runtime
                    return getRuntime();
                } else {
                    // running or ran before, and improvement made during current/last run
                    if(status == SearchStatus.IDLE || status == SearchStatus.DISPOSED){
                        // idle or disposed: return last time without improvement of previous run
                        return stopTime - lastImprovementTime;
                    } else {
                        // running or terminating: return time elapsed since last improvement
                        return System.currentTimeMillis() - lastImprovementTime;
                    }
                }
            }
        }
    }
public long getTimeWithoutImprovement ( ) { synchronized ( statusLock ) { if ( status == SearchStatus . INITIALIZING ) { return JamesConstants . INVALID_TIME_SPAN ; } else { if ( lastImprovementTime == JamesConstants . INVALID_TIMESTAMP ) { return getRuntime ( ) ; } else { if ( status == SearchStatus . IDLE || status == SearchStatus . DISPOSED ) { return stopTime - lastImprovementTime ; } else { return System . currentTimeMillis ( ) - lastImprovementTime ; } } } } }
<p>
Get the amount of time elapsed during the <i>current</i> (or last) run, without finding any further improvement
(in milliseconds). The precise return value depends on the status of the search:
</p>
<ul>
<li>
If the search is either RUNNING or TERMINATING, but no improvements have yet been made during the current
run, the returned value is equal to the current runtime; else it reflects the time elapsed since the last
improvement during the current run.
</li>
<li>
If the search is IDLE or DISPOSED, but has been run before, the time without improvement observed during the
last run, up to the point when this run completed, is returned. Before the first run, the return value is
{@link JamesConstants#INVALID_TIME_SPAN}.
</li>
<li>
While INITIALIZING the current run, {@link JamesConstants#INVALID_TIME_SPAN} is returned.
</li>
</ul>
<p>
The return value is always positive, except in those cases when {@link JamesConstants#INVALID_TIME_SPAN}
is returned.
</p>

@return time without finding improvements during the current (or last) run, in milliseconds