lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r695574 - /lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
Date Mon, 15 Sep 2008 18:33:34 GMT
Author: mikemccand
Date: Mon Sep 15 11:33:33 2008
New Revision: 695574

URL: http://svn.apache.org/viewvc?rev=695574&view=rev
Log:
fix IndexWriter's javadocs for commit

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java?rev=695574&r1=695573&r2=695574&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java Mon Sep 15 11:33:33
2008
@@ -81,7 +81,7 @@
   large RAM buffer.  Note that flushing just moves the
   internal buffered state in IndexWriter into the index, but
   these changes are not visible to IndexReader until either
-  {@link #commit} or {@link #close} is called.  A flush may
+  {@link #commit()} or {@link #close} is called.  A flush may
   also trigger one or more segment merges which by default
   run with a background thread so as not to block the
   addDocument calls (see <a href="#mergePolicy">below</a>
@@ -103,7 +103,7 @@
   as new files, but are not committed (no new
   <code>segments_N</code> file is written referencing the
   new files, nor are the files sync'd to stable storage)
-  until {@link #commit} or {@link #close} is called.  If something
+  until {@link #commit()} or {@link #close} is called.  If something
   goes terribly wrong (for example the JVM crashes), then
   the index will reflect none of the changes made since the
   last commit, or the starting state if commit was not called.
@@ -123,7 +123,7 @@
   no guarantee when exactly an auto commit will occur (it
   used to be after every flush, but it is now after every
   completed merge, as of 2.4).  If you want to force a
-  commit, call {@link #commit}, or, close the writer.  Once
+  commit, call {@link #commit()}, or, close the writer.  Once
   a commit has finished, ({@link IndexReader} instances will
   see the changes to the index as of that commit.  When
   running in this mode, be careful not to refresh your
@@ -847,7 +847,7 @@
    * @deprecated This will be removed in 3.0, when
    * autoCommit will be hardwired to false.  Use {@link
    * #IndexWriter(Directory,Analyzer,MaxFieldLength)}
-   * instead, and call {@link #commit} when needed.
+   * instead, and call {@link #commit()} when needed.
    */
   public IndexWriter(Directory d, boolean autoCommit, Analyzer a, MaxFieldLength mfl)
     throws CorruptIndexException, LockObtainFailedException, IOException {
@@ -903,7 +903,7 @@
    * @deprecated This will be removed in 3.0, when
    * autoCommit will be hardwired to false.  Use {@link
    * #IndexWriter(Directory,Analyzer,boolean,MaxFieldLength)}
-   * instead, and call {@link #commit} when needed.
+   * instead, and call {@link #commit()} when needed.
    */
   public IndexWriter(Directory d, boolean autoCommit, Analyzer a, boolean create, MaxFieldLength
mfl)
        throws CorruptIndexException, LockObtainFailedException, IOException {
@@ -985,7 +985,7 @@
    * @deprecated This will be removed in 3.0, when
    * autoCommit will be hardwired to false.  Use {@link
    * #IndexWriter(Directory,Analyzer,IndexDeletionPolicy,MaxFieldLength)}
-   * instead, and call {@link #commit} when needed.
+   * instead, and call {@link #commit()} when needed.
    */
   public IndexWriter(Directory d, boolean autoCommit, Analyzer a, IndexDeletionPolicy deletionPolicy,
MaxFieldLength mfl)
     throws CorruptIndexException, LockObtainFailedException, IOException {
@@ -1076,7 +1076,7 @@
    * @deprecated This will be removed in 3.0, when
    * autoCommit will be hardwired to false.  Use {@link
    * #IndexWriter(Directory,Analyzer,boolean,IndexDeletionPolicy,MaxFieldLength)}
-   * instead, and call {@link #commit} when needed.
+   * instead, and call {@link #commit()} when needed.
    */
   public IndexWriter(Directory d, boolean autoCommit, Analyzer a, boolean create, IndexDeletionPolicy
deletionPolicy, MaxFieldLength mfl)
        throws CorruptIndexException, LockObtainFailedException, IOException {
@@ -1611,7 +1611,7 @@
    * Commits all changes to an index and closes all
    * associated files.  Note that this may be a costly
    * operation, so, try to re-use a single writer instead of
-   * closing and opening a new one.  See {@link #commit} for
+   * closing and opening a new one.  See {@link #commit()} for
    * caveats about write caching done by some IO devices.
    *
    * <p> If an Exception is hit during close, eg due to disk
@@ -3377,10 +3377,10 @@
    * to the Directory. 
    * <p>Note: while this will force buffered docs to be
    * pushed into the index, it will not make these docs
-   * visible to a reader.  Use {@link #commit} instead
+   * visible to a reader.  Use {@link #commit()} instead
    * @throws CorruptIndexException if the index is corrupt
    * @throws IOException if there is a low-level IO error
-   * @deprecated please call {@link #commit}) instead
+   * @deprecated please call {@link #commit()}) instead
    */
   public final void flush() throws CorruptIndexException, IOException {  
     flush(true, false, true);
@@ -3429,16 +3429,29 @@
     finishCommit();
   }
 
+  private boolean committing;
+
+  synchronized private void waitForCommit() {
+    // Only allow a single thread to do the commit, at a time:
+    while(committing)
+      doWait();
+    committing = true;
+  }
+
+  synchronized private void doneCommit() {
+    committing = false;
+    notifyAll();
+  }
+
   /**
    * <p>Commits all pending updates (added & deleted
    * documents) to the index, and syncs all referenced index
    * files, such that a reader will see the changes and the
    * index updates will survive an OS or machine crash or
-   * power loss (though, see the note below).  Note that
-   * this does not wait for any running background merges to
-   * finish.  This may be a costly operation, so you should
-   * test the cost in your application and do it only when
-   * really necessary.</p>
+   * power loss.  Note that this does not wait for any
+   * running background merges to finish.  This may be a
+   * costly operation, so you should test the cost in your
+   * application and do it only when really necessary.</p>
    *
    * <p> Note that this operation calls Directory.sync on
    * the index files.  That call should not return until the
@@ -3453,20 +3466,6 @@
    * consistency on such devices.  </p>
    */
 
-  private boolean committing;
-
-  synchronized private void waitForCommit() {
-    // Only allow a single thread to do the commit, at a time:
-    while(committing)
-      doWait();
-    committing = true;
-  }
-
-  synchronized private void doneCommit() {
-    committing = false;
-    notifyAll();
-  }
-
   public final void commit() throws CorruptIndexException, IOException {
 
     ensureOpen();



Mime
View raw message