lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r593115 - in /lucene/java/trunk/src: java/org/apache/lucene/index/ test/org/apache/lucene/index/
Date Thu, 08 Nov 2007 10:21:30 GMT
Author: mikemccand
Date: Thu Nov  8 02:21:29 2007
New Revision: 593115

URL: http://svn.apache.org/viewvc?rev=593115&view=rev
Log:
LUCENE-1047: change MergePolicy & MergeScheduler from interface to abstract base class
to have future freedom to add default methods without breaking backwards compatibility

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java
    lucene/java/trunk/src/java/org/apache/lucene/index/LogMergePolicy.java
    lucene/java/trunk/src/java/org/apache/lucene/index/MergePolicy.java
    lucene/java/trunk/src/java/org/apache/lucene/index/MergeScheduler.java
    lucene/java/trunk/src/java/org/apache/lucene/index/SerialMergeScheduler.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java?rev=593115&r1=593114&r2=593115&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java Thu Nov
 8 02:21:29 2007
@@ -31,7 +31,7 @@
  *  having to create and manage application level
  *  threads. */
 
-public class ConcurrentMergeScheduler implements MergeScheduler {
+public class ConcurrentMergeScheduler extends MergeScheduler {
 
   private int mergeThreadPriority = -1;
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/LogMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/LogMergePolicy.java?rev=593115&r1=593114&r2=593115&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/LogMergePolicy.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/LogMergePolicy.java Thu Nov  8 02:21:29
2007
@@ -37,7 +37,7 @@
  * file(s) for the segment.</p>
  */
 
-public abstract class LogMergePolicy implements MergePolicy {
+public abstract class LogMergePolicy extends MergePolicy {
 
   /** Defines the allowed range of log(size) for each
    *  level.  A level is computed by taking the max segment

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/MergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/MergePolicy.java?rev=593115&r1=593114&r2=593115&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/MergePolicy.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/MergePolicy.java Thu Nov  8 02:21:29
2007
@@ -52,7 +52,7 @@
  * LogByteSizeMergePolicy}.</p>
  */
 
-public interface MergePolicy {
+public abstract class MergePolicy {
 
   /** OneMerge provides the information necessary to perform
    *  an individual primitive merge operation, resulting in
@@ -152,7 +152,7 @@
 
   /** Exception thrown if there are any problems while
    *  executing a merge. */
-  public class MergeException extends RuntimeException {
+  public static class MergeException extends RuntimeException {
     public MergeException(String message) {
       super(message);
     }
@@ -171,9 +171,9 @@
    * @param segmentInfos the total set of segments in the index
    * @param writer IndexWriter instance
    */
-  MergeSpecification findMerges(SegmentInfos segmentInfos,
-                                IndexWriter writer)
-     throws CorruptIndexException, IOException;
+  abstract MergeSpecification findMerges(SegmentInfos segmentInfos,
+                                         IndexWriter writer)
+    throws CorruptIndexException, IOException;
 
   /**
    * Determine what set of merge operations are necessary in
@@ -190,26 +190,26 @@
    *   SegmentInfo instances that must be merged away.  This
    *   may be a subset of all SegmentInfos.
    */
-  MergeSpecification findMergesForOptimize(SegmentInfos segmentInfos,
-                                           IndexWriter writer,
-                                           int maxSegmentCount,
-                                           Set segmentsToOptimize)
-     throws CorruptIndexException, IOException;
+  abstract MergeSpecification findMergesForOptimize(SegmentInfos segmentInfos,
+                                                    IndexWriter writer,
+                                                    int maxSegmentCount,
+                                                    Set segmentsToOptimize)
+    throws CorruptIndexException, IOException;
 
   /**
    * Release all resources for the policy.
    */
-  void close();
+  abstract void close();
 
   /**
    * Returns true if a newly flushed (not from merge)
    * segment should use the compound file format.
    */
-  boolean useCompoundFile(SegmentInfos segments, SegmentInfo newSegment);
+  abstract boolean useCompoundFile(SegmentInfos segments, SegmentInfo newSegment);
 
   /**
    * Returns true if the doc store files should use the
    * compound file format.
    */
-  boolean useCompoundDocStore(SegmentInfos segments);
+  abstract boolean useCompoundDocStore(SegmentInfos segments);
 }

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/MergeScheduler.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/MergeScheduler.java?rev=593115&r1=593114&r2=593115&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/MergeScheduler.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/MergeScheduler.java Thu Nov  8 02:21:29
2007
@@ -24,13 +24,13 @@
  *  selected by a {@link MergePolicy}.  The default
  *  MergeScheduler is {@link ConcurrentMergeScheduler}. */
 
-public interface MergeScheduler {
+public abstract class MergeScheduler {
 
   /** Run the merges provided by {@link IndexWriter#getNextMerge()}. */
-  void merge(IndexWriter writer)
+  abstract void merge(IndexWriter writer)
     throws CorruptIndexException, IOException;
 
   /** Close this MergeScheduler. */
-  void close()
+  abstract void close()
     throws CorruptIndexException, IOException;
 }

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SerialMergeScheduler.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/SerialMergeScheduler.java?rev=593115&r1=593114&r2=593115&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SerialMergeScheduler.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SerialMergeScheduler.java Thu Nov 
8 02:21:29 2007
@@ -21,7 +21,7 @@
 
 /** A {@link MergeScheduler} that simply does each merge
  *  sequentially, using the current thread. */
-public class SerialMergeScheduler implements MergeScheduler {
+public class SerialMergeScheduler extends MergeScheduler {
 
   /** Just do the merges in sequence. We do this
    * "synchronized" so that even if the application is using

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=593115&r1=593114&r2=593115&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestIndexWriter.java Thu Nov  8 02:21:29
2007
@@ -1607,7 +1607,7 @@
 
   // Just intercepts all merges & verifies that we are never
   // merging a segment with >= 20 (maxMergeDocs) docs
-  private class MyMergeScheduler implements MergeScheduler {
+  private class MyMergeScheduler extends MergeScheduler {
     synchronized public void merge(IndexWriter writer)
       throws CorruptIndexException, IOException {
 



Mime
View raw message