lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o...@apache.org
Subject cvs commit: jakarta-lucene/src/java/org/apache/lucene/index IndexReader.java IndexWriter.java SegmentReader.java
Date Fri, 17 Oct 2003 10:49:42 GMT
otis        2003/10/17 03:49:42

  Modified:    src/java/org/apache/lucene/index IndexReader.java
                        IndexWriter.java SegmentReader.java
  Log:
  - Fixed a bug with usage of IndexWriter.*_LOCK_NAME constants.
  
  Revision  Changes    Path
  1.20      +7 -7      jakarta-lucene/src/java/org/apache/lucene/index/IndexReader.java
  
  Index: IndexReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/IndexReader.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- IndexReader.java	13 Oct 2003 14:22:27 -0000	1.19
  +++ IndexReader.java	17 Oct 2003 10:49:42 -0000	1.20
  @@ -108,7 +108,7 @@
     public static IndexReader open(final Directory directory) throws IOException{
       synchronized (directory) {			  // in- & inter-process sync
         return (IndexReader)new Lock.With(
  -          directory.makeLock("IndexWriter.COMMIT_LOCK_NAME"),
  +          directory.makeLock(IndexWriter.COMMIT_LOCK_NAME),
             IndexWriter.COMMIT_LOCK_TIMEOUT) {
             public Object doBody() throws IOException {
               IndexReader result = null;
  @@ -269,7 +269,7 @@
     */
     public final synchronized void delete(int docNum) throws IOException {
       if (writeLock == null) {
  -      Lock writeLock = directory.makeLock("IndexWriter.WRITE_LOCK_NAME");
  +      Lock writeLock = directory.makeLock(IndexWriter.WRITE_LOCK_NAME);
         if (!writeLock.obtain(IndexWriter.WRITE_LOCK_TIMEOUT)) // obtain write lock
           throw new IOException("Index locked for write: " + writeLock);
         this.writeLock = writeLock;
  @@ -360,8 +360,8 @@
      */
       public static boolean isLocked(Directory directory) throws IOException {
         return
  -        directory.makeLock("IndexWriter.WRITE_LOCK_NAME").isLocked() ||
  -        directory.makeLock("IndexWriter.COMMIT_LOCK_NAME").isLocked();
  +        directory.makeLock(IndexWriter.WRITE_LOCK_NAME).isLocked() ||
  +        directory.makeLock(IndexWriter.COMMIT_LOCK_NAME).isLocked();
   
       }
   
  @@ -383,7 +383,7 @@
       * currently accessing this index.
       */
       public static void unlock(Directory directory) throws IOException {
  -      directory.makeLock("IndexWriter.WRITE_LOCK_NAME").release();
  -      directory.makeLock("IndexWriter.COMMIT_LOCK_NAME").release();
  +      directory.makeLock(IndexWriter.WRITE_LOCK_NAME).release();
  +      directory.makeLock(IndexWriter.COMMIT_LOCK_NAME).release();
       }
   }
  
  
  
  1.18      +3 -3      jakarta-lucene/src/java/org/apache/lucene/index/IndexWriter.java
  
  Index: IndexWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/IndexWriter.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- IndexWriter.java	13 Oct 2003 14:22:27 -0000	1.17
  +++ IndexWriter.java	17 Oct 2003 10:49:42 -0000	1.18
  @@ -169,13 +169,13 @@
       directory = d;
       analyzer = a;
   
  -    Lock writeLock = directory.makeLock("IndexWriter.WRITE_LOCK_NAME");
  +    Lock writeLock = directory.makeLock(IndexWriter.WRITE_LOCK_NAME);
       if (!writeLock.obtain(WRITE_LOCK_TIMEOUT)) // obtain write lock
         throw new IOException("Index locked for write: " + writeLock);
       this.writeLock = writeLock;                   // save it
   
       synchronized (directory) {			  // in- & inter-process sync
  -      new Lock.With(directory.makeLock("COMMIT_LOCK_NAME"), COMMIT_LOCK_TIMEOUT) {
  +      new Lock.With(directory.makeLock(IndexWriter.COMMIT_LOCK_NAME), COMMIT_LOCK_TIMEOUT)
{
             public Object doBody() throws IOException {
               if (create)
                 segmentInfos.write(directory);
  @@ -398,7 +398,7 @@
                                               directory));
   
       synchronized (directory) {			  // in- & inter-process sync
  -      new Lock.With(directory.makeLock("COMMIT_LOCK_NAME"), COMMIT_LOCK_TIMEOUT) {
  +      new Lock.With(directory.makeLock(IndexWriter.COMMIT_LOCK_NAME), COMMIT_LOCK_TIMEOUT)
{
             public Object doBody() throws IOException {
               segmentInfos.write(directory);	  // commit before deleting
               deleteSegments(segmentsToDelete);	  // delete now-unused segments
  
  
  
  1.13      +2 -2      jakarta-lucene/src/java/org/apache/lucene/index/SegmentReader.java
  
  Index: SegmentReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/SegmentReader.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SegmentReader.java	13 Oct 2003 14:25:54 -0000	1.12
  +++ SegmentReader.java	17 Oct 2003 10:49:42 -0000	1.13
  @@ -137,7 +137,7 @@
     final synchronized void doClose() throws IOException {
       if (deletedDocsDirty) {
         synchronized (directory) {		  // in- & inter-process sync
  -        new Lock.With(directory.makeLock("IndexWriter.COMMIT_LOCK_NAME"),
  +        new Lock.With(directory.makeLock(IndexWriter.COMMIT_LOCK_NAME),
             IndexWriter.COMMIT_LOCK_TIMEOUT) {
             public Object doBody() throws IOException {
               deletedDocs.write(directory, segment + ".tmp");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message