[Katta-commits] SF.net SVN: katta:[395] trunk
Brought to you by:
joa23
From: <pi...@us...> - 2009-03-27 16:14:13
|
Revision: 395 http://katta.svn.sourceforge.net/katta/?rev=395&view=rev Author: pipenb Date: 2009-03-27 16:14:03 +0000 (Fri, 27 Mar 2009) Log Message: ----------- Hits is now thread safe, because it is used by multiple searchers that are running concurrently to collect their results. Modified Paths: -------------- trunk/CHANGES.txt trunk/src/main/java/net/sf/katta/node/Hits.java Modified: trunk/CHANGES.txt =================================================================== --- trunk/CHANGES.txt 2009-03-27 14:07:18 UTC (rev 394) +++ trunk/CHANGES.txt 2009-03-27 16:14:03 UTC (rev 395) @@ -1,6 +1,7 @@ Katta Change Log katta 0.5-dev + Hits is now thread safe, because it is used by multiple searchers that are running concurrently to collect their results DocumentFrequenceWritableTest is now thread safe doc and term frequencies are always computed correctly fix KATTA-24, update to lucene 2.4.1 fix KATTA-21 Modified: trunk/src/main/java/net/sf/katta/node/Hits.java =================================================================== --- trunk/src/main/java/net/sf/katta/node/Hits.java 2009-03-27 14:07:18 UTC (rev 394) +++ trunk/src/main/java/net/sf/katta/node/Hits.java 2009-03-27 16:14:03 UTC (rev 395) @@ -21,6 +21,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Vector; +import java.util.concurrent.atomic.AtomicInteger; import net.sf.katta.util.MergeSort; @@ -33,11 +35,11 @@ */ private static final long serialVersionUID = -732226190122340208L; - private List<List<Hit>> _hitsList = new ArrayList<List<Hit>>(); + private List<List<Hit>> _hitsList = new Vector<List<Hit>>(); private List<Hit> _sortedList; - private int _totalHits; + private AtomicInteger _totalHits = new AtomicInteger(); public List<Hit> getHits() { if (_sortedList == null) { @@ -83,11 +85,11 @@ } public int size() { - return _totalHits; + return _totalHits.get(); } public void setTotalHits(final int totalHits) { - _totalHits = totalHits; + _totalHits.set(totalHits); } public void sort(final int count) { @@ -179,7 +181,7 @@ // } public void addTotalHits(final int size) { - _totalHits += size; + _totalHits.addAndGet(size); } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |