mirror of
https://github.com/querydsl/querydsl.git
synced 2026-07-03 21:07:49 +08:00
Minor tweaking
This commit is contained in:
parent
948ff3835e
commit
1cc08c1455
@ -20,10 +20,6 @@ public class LuceneSearcher {
|
||||
this.searcher = searcher;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
release();
|
||||
}
|
||||
|
||||
public boolean isCurrent() {
|
||||
try {
|
||||
return searcher.getIndexReader().isCurrent();
|
||||
|
||||
@ -102,7 +102,7 @@ public class LuceneSessionFactoryImpl implements LuceneSessionFactory {
|
||||
LuceneSearcher s = new LuceneSearcher(new IndexSearcher(directory));
|
||||
if (!searcher.compareAndSet(expected, s)) {
|
||||
// Some thread already created a new one so just close this
|
||||
s.close();
|
||||
s.release();
|
||||
} else {
|
||||
// Incrementing the reference count first time
|
||||
// We want to keep using the same reader until the index is changed
|
||||
|
||||
@ -72,7 +72,7 @@ public class LuceneSessionImpl implements LuceneSession {
|
||||
|
||||
if (searcher != null) {
|
||||
try {
|
||||
searcher.close();
|
||||
searcher.release();
|
||||
} catch (QueryException e) {
|
||||
searcherException = e;
|
||||
}
|
||||
@ -100,7 +100,7 @@ public class LuceneSessionImpl implements LuceneSession {
|
||||
writer.commit();
|
||||
|
||||
if (searcher != null) {
|
||||
searcher.close();
|
||||
searcher.release();
|
||||
}
|
||||
searcher = null;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user