Index: C:/Documents and Settings/gec/workspace/xwiki - trunk/core/src/main/java/com/xpn/xwiki/plugin/lucene/XWikiDocumentQueue.java =================================================================== --- C:/Documents and Settings/gec/workspace/xwiki - trunk/core/src/main/java/com/xpn/xwiki/plugin/lucene/XWikiDocumentQueue.java (revision 2136) +++ C:/Documents and Settings/gec/workspace/xwiki - trunk/core/src/main/java/com/xpn/xwiki/plugin/lucene/XWikiDocumentQueue.java (working copy) @@ -26,6 +26,10 @@ import java.util.Map; /** + * This class represents a Queue (FirstInFirstOut) for XWikiDocument + * objects. It is used during indexing of the wiki. The rebuilding of + * the index is done, until the processiong queue is empty. + * * @version $Id: $ */ public class XWikiDocumentQueue @@ -31,7 +35,7 @@ public class XWikiDocumentQueue { /** - * maps names of documents to the document instances itself + * maps names of documents to the document instances itself. */ private Map documentsByName = new HashMap(); @@ -36,10 +40,13 @@ private Map documentsByName = new HashMap(); /** - * maintains fifo order + * maintains fifo order. */ private Buffer namesQueue = new UnboundedFifoBuffer(); + /** + * @return remove an item from our queue and return it. + */ public synchronized IndexData remove() { return (IndexData) documentsByName.remove(namesQueue.remove()); @@ -45,6 +52,9 @@ return (IndexData) documentsByName.remove(namesQueue.remove()); } + /** + * @param data IndexData object to add to our queue + */ public synchronized void add(IndexData data) { final String key = data.toString(); @@ -57,6 +67,9 @@ documentsByName.put(key, data); } + /** + * @return true if our queue is empty. + */ public synchronized boolean isEmpty() { return namesQueue.isEmpty(); @@ -62,6 +75,9 @@ return namesQueue.isEmpty(); } + /** + * @return number of elements in our queue. + */ public long getSize() { return namesQueue.size();