LUCENE-3709: properly release primary output lock if wrapper creation fails

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1234398 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2012-01-21 19:10:41 +00:00
parent af9b4d816f
commit acf9e1333d
1 changed files with 1 additions and 3 deletions

View File

@ -255,10 +255,8 @@ final class CompoundFileWriter implements Closeable{
assert !seenIDs.contains(id): "file=\"" + name + "\" maps to id=\"" + id + "\", which was already written"; assert !seenIDs.contains(id): "file=\"" + name + "\" maps to id=\"" + id + "\", which was already written";
seenIDs.add(id); seenIDs.add(id);
final DirectCFSIndexOutput out; final DirectCFSIndexOutput out;
if (outputTaken.compareAndSet(false, true)) { if ((outputLocked = outputTaken.compareAndSet(false, true))) {
out = new DirectCFSIndexOutput(getOutput(), entry, false); out = new DirectCFSIndexOutput(getOutput(), entry, false);
outputLocked = true;
success = true;
} else { } else {
entry.dir = this.directory; entry.dir = this.directory;
if (directory.fileExists(name)) { if (directory.fileExists(name)) {