NIHVIVO-3531 DeltaComputer timing
This commit is contained in:
parent
5b89150d4f
commit
f7d585b0c3
1 changed files with 28 additions and 19 deletions
|
@ -1021,10 +1021,11 @@ public class SimpleReasoner extends StatementListener {
|
||||||
|
|
||||||
if (event instanceof BulkUpdateEvent) {
|
if (event instanceof BulkUpdateEvent) {
|
||||||
if (((BulkUpdateEvent) event).getBegin()) {
|
if (((BulkUpdateEvent) event).getBegin()) {
|
||||||
eventCount++;
|
|
||||||
log.info("received a bulk update begin event.");
|
log.info("received a bulk update begin event");
|
||||||
if (batchMode1 || batchMode2) {
|
if (deltaComputerProcessing) {
|
||||||
log.info("received a bulk update begin event while already in batch update mode; this event will be ignored.");
|
eventCount++;
|
||||||
|
log.info("received a bulk update begin event while processing in asynchronous mode. Event count = " + eventCount);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
batchMode1 = true;
|
batchMode1 = true;
|
||||||
|
@ -1041,13 +1042,13 @@ public class SimpleReasoner extends StatementListener {
|
||||||
log.info("initializing batch mode 1");
|
log.info("initializing batch mode 1");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
eventCount--;
|
|
||||||
log.info("received a bulk update end event");
|
log.info("received a bulk update end event");
|
||||||
if (!deltaComputerProcessing) {
|
if (!deltaComputerProcessing) {
|
||||||
deltaComputerProcessing = true;
|
deltaComputerProcessing = true;
|
||||||
new Thread(new DeltaComputer(),"DeltaComputer").start();
|
new Thread(new DeltaComputer(),"DeltaComputer").start();
|
||||||
} else {
|
} else {
|
||||||
log.info("received a bulk update end event while currently processing in aynchronous mode");
|
eventCount--;
|
||||||
|
log.info("received a bulk update end event while currently processing in aynchronous mode. Event count = " + eventCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1064,17 +1065,23 @@ public class SimpleReasoner extends StatementListener {
|
||||||
log.info("entering batch mode 2");
|
log.info("entering batch mode 2");
|
||||||
} else {
|
} else {
|
||||||
deltaComputerProcessing = false;
|
deltaComputerProcessing = false;
|
||||||
|
if (eventCount == 0) {
|
||||||
|
batchMode1 = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (batchMode2) {
|
} else if (batchMode2) {
|
||||||
aBoxDeltaModeler1.getRetractions().removeAll();
|
aBoxDeltaModeler1.getRetractions().removeAll();
|
||||||
|
|
||||||
if (aBoxDeltaModeler2.getRetractions().size() > 0) {
|
if (aBoxDeltaModeler2.getRetractions().size() > 0) {
|
||||||
batchMode1 = true;
|
batchMode1 = true;
|
||||||
batchMode2 = false;
|
batchMode2 = false;
|
||||||
log.info("entering batch mode 1");
|
log.info("entering batch mode 1");
|
||||||
} else {
|
} else {
|
||||||
deltaComputerProcessing = false;
|
deltaComputerProcessing = false;
|
||||||
}
|
if (eventCount == 0) {
|
||||||
|
batchMode2 = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log.warn("unexpected condition, invoked when batchMode1 and batchMode2 were both false");
|
log.warn("unexpected condition, invoked when batchMode1 and batchMode2 were both false");
|
||||||
deltaComputerProcessing = false;
|
deltaComputerProcessing = false;
|
||||||
|
@ -1083,7 +1090,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
return deltaComputerProcessing;
|
return deltaComputerProcessing;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DeltaComputer extends Thread {
|
private class DeltaComputer extends Thread {
|
||||||
public DeltaComputer() {
|
public DeltaComputer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1115,10 +1122,12 @@ public class SimpleReasoner extends StatementListener {
|
||||||
try {
|
try {
|
||||||
log.info("started computing inferences for batch " + qualifier + " updates");
|
log.info("started computing inferences for batch " + qualifier + " updates");
|
||||||
iter = retractions.listStatements();
|
iter = retractions.listStatements();
|
||||||
|
|
||||||
|
|
||||||
while (iter.hasNext() && !stopRequested) {
|
while (iter.hasNext() && !stopRequested) {
|
||||||
Statement stmt = iter.next();
|
Statement stmt = iter.next();
|
||||||
|
num++;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (stmt.getPredicate().equals(RDF.type)) {
|
if (stmt.getPredicate().equals(RDF.type)) {
|
||||||
removedABoxTypeAssertion(stmt, inferenceModel);
|
removedABoxTypeAssertion(stmt, inferenceModel);
|
||||||
|
@ -1132,7 +1141,6 @@ public class SimpleReasoner extends StatementListener {
|
||||||
log.error("exception in batch mode ",e);
|
log.error("exception in batch mode ",e);
|
||||||
}
|
}
|
||||||
|
|
||||||
num++;
|
|
||||||
if ((num % 6000) == 0) {
|
if ((num % 6000) == 0) {
|
||||||
log.info("still computing inferences for batch " + qualifier + " update...");
|
log.info("still computing inferences for batch " + qualifier + " update...");
|
||||||
}
|
}
|
||||||
|
@ -1160,10 +1168,11 @@ public class SimpleReasoner extends StatementListener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("finished computing inferences for batch " + qualifier + " updates. Processed " + num + " statements.");
|
log.info("finished computing inferences for batch " + qualifier + " updates");
|
||||||
|
log.debug("\t--> processed " + num + " statements");
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("ending DeltaComputer.run");
|
log.info("ending DeltaComputer.run. batchMode1 = " + batchMode1 + ", batchMode2 = " + batchMode2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue