Пример #1
0
 public synchronized void run(List<Operation> operations, int nrConcurrent) {
   sLog.info("Running " + operations.size() + " tasks...");
   iRunners = new ArrayList<Runner>();
   iTasks = new Pool(operations);
   iFinished.clear();
   iExec.clear();
   iQuality.clear();
   iT0 = System.currentTimeMillis();
   for (int i = 0; i < nrConcurrent; i++) {
     Runner r = new Runner();
     Thread t = new Thread(r);
     t.setDaemon(true);
     t.setName("Runner #" + (1 + i));
     t.start();
     iRunners.add(r);
   }
   do {
     try {
       Thread.sleep(10000);
     } catch (InterruptedException e) {
       break;
     }
     sLog.info(toString());
     logCounters();
   } while (nrFinished() < operations.size());
   sLog.info("All " + toString());
 }
    public void run() {

      for (int i = 0; i < 10; i++) {
        c.decrement();
        try {
          Thread.sleep(100);
        } catch (InterruptedException ie) {
          // nothing to do
        }
      }
    }
 @Override
 public void run() {
   counter.decrement();
 }
Пример #4
0
 public double averageQuality() {
   return iQuality.value() / iQuality.count();
 }
Пример #5
0
 public double totalExecutionTimeInSeconds() {
   return iExec.value() / 1000.0;
 }
Пример #6
0
 public int nrFinished() {
   return iFinished.count();
 }