Make sure the storage writer is closed before running mergeInfo in multi-threaded output management
-- It's not clear this is cause of GSA-484 but it will help confirm that it's not the cause
This commit is contained in:
parent
7a247df922
commit
52bfe8db8a
|
|
@ -61,6 +61,7 @@ public class VariantContextWriterStorage implements Storage<VariantContextWriter
|
||||||
protected final File file;
|
protected final File file;
|
||||||
protected OutputStream stream;
|
protected OutputStream stream;
|
||||||
protected final VariantContextWriter writer;
|
protected final VariantContextWriter writer;
|
||||||
|
boolean closed = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an object which will write directly into the output file provided by the stub.
|
* Constructs an object which will write directly into the output file provided by the stub.
|
||||||
|
|
@ -172,10 +173,13 @@ public class VariantContextWriterStorage implements Storage<VariantContextWriter
|
||||||
if(file != null)
|
if(file != null)
|
||||||
logger.debug("Closing temporary file " + file.getAbsolutePath());
|
logger.debug("Closing temporary file " + file.getAbsolutePath());
|
||||||
writer.close();
|
writer.close();
|
||||||
|
closed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mergeInto(VariantContextWriterStorage target) {
|
public void mergeInto(VariantContextWriterStorage target) {
|
||||||
try {
|
try {
|
||||||
|
if ( ! closed )
|
||||||
|
throw new ReviewedStingException("Writer not closed, but we are merging into the file!");
|
||||||
final String targetFilePath = target.file != null ? target.file.getAbsolutePath() : "/dev/stdin";
|
final String targetFilePath = target.file != null ? target.file.getAbsolutePath() : "/dev/stdin";
|
||||||
logger.debug(String.format("Merging %s into %s",file.getAbsolutePath(),targetFilePath));
|
logger.debug(String.format("Merging %s into %s",file.getAbsolutePath(),targetFilePath));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue