added non-threaded close() method for logging

This commit is contained in:
NoName11234 2024-01-25 20:08:32 +01:00
parent c14dd6e97c
commit c292ff2d9e
3 changed files with 18 additions and 3 deletions

View File

@ -65,6 +65,10 @@ public class TypeUnify2Task extends TypeUnifyTask {
}
public void closeLogFile() {
logFile.close();
if(parallel){
logFile.close();
}else{
logFile.closeNonThreaded();
}
}
}

View File

@ -186,7 +186,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
}else{
this.logFile = new WriterActiveObject(new OutputStreamWriter(new NullOutputStream()), pool);
}
logFile.write("");
}
catch (IOException e) {
System.err.println("log-File nicht vorhanden");
@ -268,7 +267,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
Set<Set<UnifyPair>> res = unify(neweq, remainingOderconstraints, fc, parallel, rekTiefeField, new HashSet<>());
noOfThread--;
logFile.close();
if(parallel){
logFile.close();
}else{
logFile.closeNonThreaded();
}
if (isUndefinedPairSetSet(res)) {
//fuer debug-Zwecke

View File

@ -42,4 +42,12 @@ public class WriterActiveObject {
throw new RuntimeException(e);
}
}
public void closeNonThreaded(){
try {
writer.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}