diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/ReferenceDataSource.java b/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/ReferenceDataSource.java index b9c848c6b..ab6b7502d 100644 --- a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/ReferenceDataSource.java +++ b/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/ReferenceDataSource.java @@ -143,39 +143,39 @@ public class ReferenceDataSource implements ReferenceDataSourceProgressListener * but is incomplete). To avoid this, obtain shared locks on both files before creating IndexedFastaSequenceFile. */ -// FSLockWithShared dictLock = new FSLockWithShared(dictFile,true); -// FSLockWithShared indexLock = new FSLockWithShared(indexFile,true); -// try { -// try { -// if (!dictLock.sharedLock()) { -// throw new StingException("Could not open dictionary file because a lock could not be obtained."); -// } -// } -// catch(FileSystemInabilityToLockException ex) { -// logger.info(String.format("Unable to create a lock on dictionary file: %s",ex.getMessage())); -// logger.info("Treating existing dictionary file as complete."); -// } -// -// try { -// if (!indexLock.sharedLock()) { -// throw new StingException("Could not open index file because a lock could not be obtained."); -// } -// } -// catch(FileSystemInabilityToLockException ex) { -// logger.info(String.format("Unable to create a lock on index file: %s",ex.getMessage())); -// logger.info("Treating existing index file as complete."); -// } + FSLockWithShared dictLock = new FSLockWithShared(dictFile,true); + FSLockWithShared indexLock = new FSLockWithShared(indexFile,true); + try { + try { + if (!dictLock.sharedLock()) { + throw new StingException("Could not open dictionary file because a lock could not be obtained."); + } + } + catch(FileSystemInabilityToLockException ex) { + logger.info(String.format("Unable to create a lock on dictionary file: %s",ex.getMessage())); + logger.info("Treating existing dictionary file as complete."); + } - index = new IndexedFastaSequenceFile(fastaFile); -// -// } -// catch (Exception e) { -// throw new StingException(String.format("Error reading fasta file %s.", fastaFile.getAbsolutePath()), e); -// } -// finally { -// dictLock.unlock(); -// indexLock.unlock(); -// } + try { + if (!indexLock.sharedLock()) { + throw new StingException("Could not open index file because a lock could not be obtained."); + } + } + catch(FileSystemInabilityToLockException ex) { + logger.info(String.format("Unable to create a lock on index file: %s",ex.getMessage())); + logger.info("Treating existing index file as complete."); + } + + index = new IndexedFastaSequenceFile(fastaFile); + + } + catch (Exception e) { + throw new StingException(String.format("Error reading fasta file %s.", fastaFile.getAbsolutePath()), e); + } + finally { + dictLock.unlock(); + indexLock.unlock(); + } } /**