Skip to content
Snippets Groups Projects
Commit 8991e729 authored by Sebastian Krings's avatar Sebastian Krings
Browse files

catch timeout and report it to prolog

parent 5a40c1f1
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,7 @@ public final class Request {
* have been send to the stream
*/
public boolean writeNextSolutions(final IPrologTermOutput pto, final int max) {
try {
boolean solutionsPresent = true;
int num;
int size = 0;
......@@ -93,10 +94,18 @@ public final class Request {
pto.closeTerm();
pto.fullstop();
if (logger.isLoggable(Level.FINE)) {
logger.fine("wrote " + num + " solutions, computed in " + duration
+ "ms");
logger.fine("wrote " + num + " solutions, computed in "
+ duration + "ms");
}
return solutionsPresent;
} catch (RuntimeException ex) {
// timeout of the solver is wrapped in a runtime exception
if ("timed out".equals(ex.getMessage())) {
pto.printAtom("sat_timeout");
return true;
}
throw (ex);
}
}
private void printInstances(Instance[] solutions, IPrologTermOutput pto) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment