Always create output files, even if no output was written to them.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1627 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
8f9dd03e87
commit
b69eb208a6
|
|
@ -142,6 +142,8 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Hierar
|
|||
|
||||
printOnTraversalDone(result);
|
||||
|
||||
getOutputTracker().close();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@ public class LinearMicroScheduler extends MicroScheduler {
|
|||
|
||||
printOnTraversalDone(result);
|
||||
|
||||
getOutputTracker().close();
|
||||
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,19 +65,16 @@ public abstract class OutputTracker {
|
|||
// Otherwise, initialize them separately.
|
||||
if( outFileName != null && outFileName.equals(errFileName) ) {
|
||||
outStub = errStub = new OutputStreamStub(new File(outFileName));
|
||||
outStub.register(this);
|
||||
outputs.put(outStub,null);
|
||||
addOutput(outStub);
|
||||
}
|
||||
else {
|
||||
outStub = (outFileName != null) ? new OutputStreamStub(new File(outFileName))
|
||||
: new OutputStreamStub(System.out);
|
||||
outStub.register(this);
|
||||
outputs.put(outStub,null);
|
||||
addOutput(outStub);
|
||||
|
||||
errStub = (errFileName != null) ? new OutputStreamStub(new File(errFileName))
|
||||
: new OutputStreamStub(System.err);
|
||||
errStub.register(this);
|
||||
outputs.put(errStub,null);
|
||||
addOutput(errStub);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -127,6 +124,20 @@ public abstract class OutputTracker {
|
|||
outputs.put(stub,null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close down all existing output streams.
|
||||
*/
|
||||
public void close() {
|
||||
for( Stub stub: outputs.keySet() ) {
|
||||
// If the stream hasn't yet been created, create it so that there's at least an empty file present.
|
||||
if( outputs.get(stub) == null )
|
||||
getTargetStream(stub);
|
||||
|
||||
// Close down the storage.
|
||||
outputs.get(stub).close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects the target stream for this data.
|
||||
* @param stub The stub for this stream.
|
||||
|
|
|
|||
Loading…
Reference in New Issue