Package org.sf.mustru.utils

Examples of org.sf.mustru.utils.IndexTools


  public void testRepair()
  {
   System.out.println("Started testing repair index");
   int TIMELIMIT = 1000; //*-- time limit to perform the repair operation
   String tmpFile = Constants.MUSTRU_HOME + File.separator + "tmp" + File.separator + "repair.txt";
   IndexTools itools = new IndexTools(tmpFile);
   itools.setRunRepair(true); itools.setRunSummary(false);
   itools.start();
   boolean done = false; long scanStart = new Date().getTime();
   while (!done)
  { done = true;
    long start = new Date().getTime();
    try { itools.join(1000); catch (InterruptedException e) { }
    long end = new Date().getTime();
    if ( (end - start) > 750 ) done = false;
    long secs = end - scanStart; secs /= 1000;
    if ( (secs > TIMELIMIT) && itools.isAlive() )
      { itools.setRunning(false); done = true; }
  } //*-- end of while
  
   System.out.println("Finished testing repair -- check file repair.txt");
  }
View Full Code Here


  public void testSummary()
  {
   System.out.println("Started testing index summary");
   int TIMELIMIT = 1000; //*-- time limit to perform the summary operation
   String tmpFile = Constants.MUSTRU_HOME + File.separator + "tmp" + File.separator + "summary.txt";
   IndexTools itools = new IndexTools(tmpFile);
   itools.setRunRepair(false); itools.setRunSummary(true);
   itools.start();
   boolean done = false; long scanStart = new Date().getTime();
   while (!done)
   { done = true;
   long start = new Date().getTime();
   try { itools.join(1000); catch (InterruptedException e) { }
   long end = new Date().getTime();
   if ( (end - start) > 750 ) done = false;
   long secs = end - scanStart; secs /= 1000;
   if ( (secs > TIMELIMIT) && itools.isAlive() )
     { itools.setRunning(false); done = true; }
  } //*-- end of while
    
   System.out.println("Finished testing index summary -- check file index.txt");
  }
View Full Code Here

  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

View Full Code Here

  public RunSummary() { super(); }
 
  public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
   {
   monitor.beginTask("Summarizing the Index", 100);
   IndexTools itools = new IndexTools(tmpFile);
   itools.setRunRepair(false); itools.setRunSummary(true);
   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

View Full Code Here

TOP

Related Classes of org.sf.mustru.utils.IndexTools

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.