예제 #1
0
 /// <summary> Commit changes resulting from delete, undeleteAll, or setNorm operations
 ///
 /// </summary>
 /// <throws>  IOException </throws>
 protected internal void  Commit()
 {
     lock (this)
     {
         if (hasChanges)
         {
             if (directoryOwner)
             {
                 lock (directory)
                 {
                     // in- & inter-process sync
                     new AnonymousClassWith1(this, directory.MakeLock(IndexWriter.COMMIT_LOCK_NAME), IndexWriter.COMMIT_LOCK_TIMEOUT).Run();
                 }
                 if (writeLock != null)
                 {
                     writeLock.Release();                             // release write lock
                     writeLock = null;
                 }
             }
             else
             {
                 DoCommit();
             }
         }
         hasChanges = false;
     }
 }
 /// <summary>Flushes all changes to an index and closes all associated files. </summary>
 public virtual void  Close()
 {
     lock (this)
     {
         FlushRamSegments();
         ramDirectory.Close();
         writeLock.Release(); // release write lock
         writeLock = null;
         if (closeDir)
         {
             directory.Close();
         }
         System.GC.SuppressFinalize(this);
     }
 }