test
This commit is contained in:
@@ -29,6 +29,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
|
|
||||||
|
import static edu.lu.uni.serval.FixPatternParser.violations.AkkaTreeLoader.comparePairs;
|
||||||
import static edu.lu.uni.serval.FixPatternParser.violations.AkkaTreeLoader.loadRedis;
|
import static edu.lu.uni.serval.FixPatternParser.violations.AkkaTreeLoader.loadRedis;
|
||||||
import static edu.lu.uni.serval.FixPatternParser.violations.MultiThreadTreeLoader.getSimpliedTree;
|
import static edu.lu.uni.serval.FixPatternParser.violations.MultiThreadTreeLoader.getSimpliedTree;
|
||||||
|
|
||||||
@@ -68,20 +69,35 @@ public class TreeWorker extends UntypedActor {
|
|||||||
String dbDir = msg.getDbDir();
|
String dbDir = msg.getDbDir();
|
||||||
String serverWait = msg.getServerWait();
|
String serverWait = msg.getServerWait();
|
||||||
int id = msg.getId();
|
int id = msg.getId();
|
||||||
int counter = 0;
|
int counter = new Object() {
|
||||||
|
int counter = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// for (String name : files)
|
||||||
|
{
|
||||||
|
files.stream().
|
||||||
|
parallel().
|
||||||
|
peek(x -> counter++).
|
||||||
|
forEach(m ->
|
||||||
|
{
|
||||||
|
Compare compare = new Compare(poolConfig);
|
||||||
|
compare.coreCompare(m, inputPath, innerPort);
|
||||||
|
;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}.counter;
|
||||||
|
|
||||||
//
|
//
|
||||||
for (String name : files) {
|
// final ExecutorService executor = Executors.newFixedThreadPool(20);
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
final ExecutorService executor = Executors.newFixedThreadPool(20);
|
|
||||||
// // schedule the work
|
// // schedule the work
|
||||||
final Future<?> future = executor.submit(new RunnableCompare(name, inputPath, innerPort, new Compare(poolConfig)));
|
// final Future<?> future = executor.submit(new RunnableCompare(name, inputPath, innerPort, new Compare(poolConfig)));
|
||||||
try {
|
// try {
|
||||||
// wait for task to complete
|
// wait for task to complete
|
||||||
future.get(Configuration.SECONDS_TO_WAIT, TimeUnit.SECONDS);
|
// future.get(Configuration.SECONDS_TO_WAIT, TimeUnit.SECONDS);
|
||||||
counter++;
|
// Compare compare = new Compare(poolConfig);
|
||||||
|
// compare.coreCompare(name, inputPath, innerPort);
|
||||||
|
// counter++;
|
||||||
// nullDiffEntry += parser.nullMatchedDiffEntry;
|
// nullDiffEntry += parser.nullMatchedDiffEntry;
|
||||||
// nullMappingGumTreeResults += parser.nullMappingGumTreeResult;
|
// nullMappingGumTreeResults += parser.nullMappingGumTreeResult;
|
||||||
// pureDeletion += parser.pureDeletions;
|
// pureDeletion += parser.pureDeletions;
|
||||||
@@ -121,22 +137,22 @@ public class TreeWorker extends UntypedActor {
|
|||||||
// testingInfo.setLength(0);
|
// testingInfo.setLength(0);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
} catch (TimeoutException e) {
|
// } catch (TimeoutException e) {
|
||||||
future.cancel(true);
|
// future.cancel(true);
|
||||||
//// timeouts += countAlarms(positionFile, "#Timeout:");
|
////// timeouts += countAlarms(positionFile, "#Timeout:");
|
||||||
System.err.println("#Timeout: " + name);
|
// System.err.println("#Timeout: " + name);
|
||||||
} catch (InterruptedException e) {
|
// } catch (InterruptedException e) {
|
||||||
//// timeouts += countAlarms(positionFile, "#TimeInterrupted:");
|
////// timeouts += countAlarms(positionFile, "#TimeInterrupted:");
|
||||||
// System.err.println("#TimeInterrupted: " + revFile.getName());
|
//// System.err.println("#TimeInterrupted: " + revFile.getName());
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
} catch (ExecutionException e) {
|
// } catch (ExecutionException e) {
|
||||||
//// timeouts += countAlarms(positionFile, "#TimeAborted:");
|
////// timeouts += countAlarms(positionFile, "#TimeAborted:");
|
||||||
// System.err.println("#TimeAborted: " + revFile.getName());
|
//// System.err.println("#TimeAborted: " + revFile.getName());
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
} finally {
|
// } finally {
|
||||||
executor.shutdownNow();
|
// executor.shutdownNow();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
log.info("bitti");
|
log.info("bitti");
|
||||||
log.info("Worker #" + id +"finialized parsing " + counter + " files...");
|
log.info("Worker #" + id +"finialized parsing " + counter + " files...");
|
||||||
|
|||||||
Reference in New Issue
Block a user