public RunRepair() { super(); }
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
{
monitor.beginTask("Repairing Index... please be patient", 100);
IndexTools itools = new IndexTools(tmpFile);
itools.setRunRepair(true); itools.setRunSummary(false);
itools.start();
boolean done = false; long scanStart = new Date().getTime(); int times = 0;
while (!done)
{ done = true;
//*-- wait a second
try { Thread.sleep(1000); } catch (InterruptedException e) { }
long end = new Date().getTime();
//*-- check if the thread is taking too much time or was manually cancelled
if (itools.isRunning()) done = false;
long secs = end - scanStart; secs /= 1000;
if ( ( (secs > TIMELIMIT) && itools.isAlive() ) ||
(monitor.isCanceled()) )
{ itools.setRunning(false); done = true; monitor.done(); setJobRan(false); }
monitor.worked( (times < 5) ? timeIncrement[times]: 1 );
times++;
} //*-- end of while