accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From medi...@apache.org
Subject svn commit: r1383696 - in /accumulo/trunk/core/src: main/java/org/apache/accumulo/core/iterators/user/ test/java/org/apache/accumulo/core/iterators/user/
Date Wed, 12 Sep 2012 00:33:34 GMT
Author: medined
Date: Wed Sep 12 00:33:34 2012
New Revision: 1383696

URL: http://svn.apache.org/viewvc?rev=1383696&view=rev
Log:
resolve findbugs 'write to static field' message in core module

Modified:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/IndexedDocIterator.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/IndexedDocIterator.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/IndexedDocIterator.java?rev=1383696&r1=1383695&r2=1383696&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/IndexedDocIterator.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/IndexedDocIterator.java
Wed Sep 12 00:33:34 2012
@@ -126,7 +126,7 @@ public class IndexedDocIterator extends 
   }
   
   @Override
-  public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String>
options, IteratorEnvironment env) throws IOException {
+  synchronized public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String>
options, IteratorEnvironment env) throws IOException {
     super.init(source, options, env);
     if (options.containsKey(indexFamilyOptionName))
       indexColf = new Text(options.get(indexFamilyOptionName));

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java?rev=1383696&r1=1383695&r2=1383696&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IndexedDocIteratorTest.java
Wed Sep 12 00:33:34 2012
@@ -65,9 +65,7 @@ public class IndexedDocIteratorTest exte
     docColf.append("type".getBytes(), 0, "type".getBytes().length);
   }
   
-  static float hitRatio = 0.1f;
-  
-  private synchronized static TreeMap<Key,Value> createSortedMap(int numRows, int numDocsPerRow,
Text[] columnFamilies, Text[] otherColumnFamilies,
+  private TreeMap<Key,Value> createSortedMap(float hitRatio, int numRows, int numDocsPerRow,
Text[] columnFamilies, Text[] otherColumnFamilies,
       HashSet<Text> docs, Text[] negatedColumns) {
     StringBuilder sb = new StringBuilder();
     Random r = new Random();
@@ -135,18 +133,18 @@ public class IndexedDocIteratorTest exte
   
   static TestRFile trf = new TestRFile();
   
-  private synchronized static SortedKeyValueIterator<Key,Value> createIteratorStack(int
numRows, int numDocsPerRow, Text[] columnFamilies,
+  private SortedKeyValueIterator<Key,Value> createIteratorStack(float hitRatio, int
numRows, int numDocsPerRow, Text[] columnFamilies,
       Text[] otherColumnFamilies, HashSet<Text> docs) throws IOException {
     Text nullText[] = new Text[0];
-    return createIteratorStack(numRows, numDocsPerRow, columnFamilies, otherColumnFamilies,
docs, nullText);
+    return createIteratorStack(hitRatio, numRows, numDocsPerRow, columnFamilies, otherColumnFamilies,
docs, nullText);
   }
   
-  private synchronized static SortedKeyValueIterator<Key,Value> createIteratorStack(int
numRows, int numDocsPerRow, Text[] columnFamilies,
+  private SortedKeyValueIterator<Key,Value> createIteratorStack(float hitRatio, int
numRows, int numDocsPerRow, Text[] columnFamilies,
       Text[] otherColumnFamilies, HashSet<Text> docs, Text[] negatedColumns) throws
IOException {
     // write a map file
     trf.openWriter(false);
     
-    TreeMap<Key,Value> inMemoryMap = createSortedMap(numRows, numDocsPerRow, columnFamilies,
otherColumnFamilies, docs, negatedColumns);
+    TreeMap<Key,Value> inMemoryMap = createSortedMap(hitRatio, numRows, numDocsPerRow,
columnFamilies, otherColumnFamilies, docs, negatedColumns);
     trf.writer.startNewLocalityGroup("docs", RFileTest.ncfs(docColf.toString()));
     for (Entry<Key,Value> entry : inMemoryMap.entrySet()) {
       if (entry.getKey().getColumnFamily().equals(docColf))
@@ -189,9 +187,9 @@ public class IndexedDocIteratorTest exte
     otherColumnFamilies[2] = new Text("D");
     otherColumnFamilies[3] = new Text("F");
     
-    hitRatio = 0.5f;
+    float hitRatio = 0.5f;
     HashSet<Text> docs = new HashSet<Text>();
-    SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs);
+    SortedKeyValueIterator<Key,Value> source = createIteratorStack(hitRatio, NUM_ROWS,
NUM_DOCIDS, columnFamilies, otherColumnFamilies, docs);
     IteratorSetting is = new IteratorSetting(1, IndexedDocIterator.class);
     IndexedDocIterator.setColumnFamilies(is, columnFamilies);
     IndexedDocIterator.setColfs(is, indexColf.toString(), docColfPrefix);
@@ -227,9 +225,9 @@ public class IndexedDocIteratorTest exte
     otherColumnFamilies[2] = new Text("D");
     otherColumnFamilies[3] = new Text("F");
     
-    hitRatio = 0.5f;
+    float hitRatio = 0.5f;
     HashSet<Text> docs = new HashSet<Text>();
-    SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs);
+    SortedKeyValueIterator<Key,Value> source = createIteratorStack(hitRatio, NUM_ROWS,
NUM_DOCIDS, columnFamilies, otherColumnFamilies, docs);
     IteratorSetting is = new IteratorSetting(1, IndexedDocIterator.class);
     IndexedDocIterator.setColumnFamilies(is, columnFamilies);
     IndexedDocIterator.setColfs(is, indexColf.toString(), docColfPrefix);
@@ -264,10 +262,10 @@ public class IndexedDocIteratorTest exte
     otherColumnFamilies[2] = new Text("D");
     otherColumnFamilies[3] = new Text("F");
     
-    hitRatio = 0.5f;
+    float hitRatio = 0.5f;
     HashSet<Text> docs = new HashSet<Text>();
-    SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs);
-    SortedKeyValueIterator<Key,Value> source2 = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs);
+    SortedKeyValueIterator<Key,Value> source = createIteratorStack(hitRatio, NUM_ROWS,
NUM_DOCIDS, columnFamilies, otherColumnFamilies, docs);
+    SortedKeyValueIterator<Key,Value> source2 = createIteratorStack(hitRatio, NUM_ROWS,
NUM_DOCIDS, columnFamilies, otherColumnFamilies, docs);
     ArrayList<SortedKeyValueIterator<Key,Value>> sourceIters = new ArrayList<SortedKeyValueIterator<Key,Value>>();
     sourceIters.add(source);
     sourceIters.add(source2);
@@ -310,9 +308,9 @@ public class IndexedDocIteratorTest exte
     otherColumnFamilies[2] = new Text("D");
     otherColumnFamilies[3] = new Text("F");
     
-    hitRatio = 0.5f;
+    float hitRatio = 0.5f;
     HashSet<Text> docs = new HashSet<Text>();
-    SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs, negatedColumns);
+    SortedKeyValueIterator<Key,Value> source = createIteratorStack(hitRatio, NUM_ROWS,
NUM_DOCIDS, columnFamilies, otherColumnFamilies, docs, negatedColumns);
     IteratorSetting is = new IteratorSetting(1, IndexedDocIterator.class);
     IndexedDocIterator.setColumnFamilies(is, columnFamilies, notFlags);
     IndexedDocIterator.setColfs(is, indexColf.toString(), docColfPrefix);

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java?rev=1383696&r1=1383695&r2=1383696&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java
Wed Sep 12 00:33:34 2012
@@ -63,15 +63,13 @@ public class IntersectingIteratorTest ex
   Text[] searchFamilies;
   boolean[] notFlags;
   
-  static int docid = 0;
+  int docid = 0;
   
   static {
     log.setLevel(Level.OFF);
   }
   
-  static float hitRatio = 0.1f;
-  
-  private synchronized static TreeMap<Key,Value> createSortedMap(int numRows, int numDocsPerRow,
Text[] columnFamilies, Text[] otherColumnFamilies,
+  private TreeMap<Key,Value> createSortedMap(float hitRatio, int numRows, int numDocsPerRow,
Text[] columnFamilies, Text[] otherColumnFamilies,
       HashSet<Text> docs, Text[] negatedColumns) {
     Random r = new Random();
     Value v = new Value(new byte[0]);
@@ -115,19 +113,19 @@ public class IntersectingIteratorTest ex
     return map;
   }
   
-  private synchronized static SortedKeyValueIterator<Key,Value> createIteratorStack(int
numRows, int numDocsPerRow, Text[] columnFamilies,
+  private SortedKeyValueIterator<Key,Value> createIteratorStack(float hitRatio, int
numRows, int numDocsPerRow, Text[] columnFamilies,
       Text[] otherColumnFamilies, HashSet<Text> docs) throws IOException {
     Text nullText[] = new Text[0];
-    return createIteratorStack(numRows, numDocsPerRow, columnFamilies, otherColumnFamilies,
docs, nullText);
+    return createIteratorStack(hitRatio, numRows, numDocsPerRow, columnFamilies, otherColumnFamilies,
docs, nullText);
   }
   
-  private synchronized static SortedKeyValueIterator<Key,Value> createIteratorStack(int
numRows, int numDocsPerRow, Text[] columnFamilies,
+  private SortedKeyValueIterator<Key,Value> createIteratorStack(float hitRatio, int
numRows, int numDocsPerRow, Text[] columnFamilies,
       Text[] otherColumnFamilies, HashSet<Text> docs, Text[] negatedColumns) throws
IOException {
-    TreeMap<Key,Value> inMemoryMap = createSortedMap(numRows, numDocsPerRow, columnFamilies,
otherColumnFamilies, docs, negatedColumns);
+    TreeMap<Key,Value> inMemoryMap = createSortedMap(hitRatio, numRows, numDocsPerRow,
columnFamilies, otherColumnFamilies, docs, negatedColumns);
     return new SortedMapIterator(inMemoryMap);
   }
   
-  private synchronized static void cleanup() throws IOException {
+  private void cleanup() throws IOException {
     docid = 0;
   }
   
@@ -151,8 +149,8 @@ public class IntersectingIteratorTest ex
     otherColumnFamilies[2] = new Text("D");
     otherColumnFamilies[3] = new Text("F");
     
-    hitRatio = 0.5f;
-    SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs);
+    float hitRatio = 0.5f;
+    SortedKeyValueIterator<Key,Value> source = createIteratorStack(hitRatio, NUM_ROWS,
NUM_DOCIDS, columnFamilies, otherColumnFamilies, docs);
     IteratorSetting is = new IteratorSetting(1, IntersectingIterator.class);
     IntersectingIterator.setColumnFamilies(is, columnFamilies);
     IntersectingIterator iter = new IntersectingIterator();
@@ -180,8 +178,8 @@ public class IntersectingIteratorTest ex
     otherColumnFamilies[2] = new Text("D");
     otherColumnFamilies[3] = new Text("F");
     
-    hitRatio = 0.5f;
-    SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs);
+    float hitRatio = 0.5f;
+    SortedKeyValueIterator<Key,Value> source = createIteratorStack(hitRatio, NUM_ROWS,
NUM_DOCIDS, columnFamilies, otherColumnFamilies, docs);
     IteratorSetting is = new IteratorSetting(1, IntersectingIterator.class);
     IntersectingIterator.setColumnFamilies(is, columnFamilies);
     IntersectingIterator iter = new IntersectingIterator();
@@ -212,9 +210,9 @@ public class IntersectingIteratorTest ex
     otherColumnFamilies[2] = new Text("D");
     otherColumnFamilies[3] = new Text("F");
     
-    hitRatio = 0.5f;
-    SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs);
-    SortedKeyValueIterator<Key,Value> source2 = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs);
+    float hitRatio = 0.5f;
+    SortedKeyValueIterator<Key,Value> source = createIteratorStack(hitRatio, NUM_ROWS,
NUM_DOCIDS, columnFamilies, otherColumnFamilies, docs);
+    SortedKeyValueIterator<Key,Value> source2 = createIteratorStack(hitRatio, NUM_ROWS,
NUM_DOCIDS, columnFamilies, otherColumnFamilies, docs);
     ArrayList<SortedKeyValueIterator<Key,Value>> sourceIters = new ArrayList<SortedKeyValueIterator<Key,Value>>();
     sourceIters.add(source);
     sourceIters.add(source2);
@@ -253,8 +251,8 @@ public class IntersectingIteratorTest ex
     otherColumnFamilies[2] = new Text("D");
     otherColumnFamilies[3] = new Text("F");
     
-    hitRatio = 0.5f;
-    SortedKeyValueIterator<Key,Value> source = createIteratorStack(NUM_ROWS, NUM_DOCIDS,
columnFamilies, otherColumnFamilies, docs, negatedColumns);
+    float hitRatio = 0.5f;
+    SortedKeyValueIterator<Key,Value> source = createIteratorStack(hitRatio, NUM_ROWS,
NUM_DOCIDS, columnFamilies, otherColumnFamilies, docs, negatedColumns);
     IteratorSetting is = new IteratorSetting(1, IntersectingIterator.class);
     IntersectingIterator.setColumnFamilies(is, columnFamilies, notFlags);
     IntersectingIterator iter = new IntersectingIterator();



Mime
View raw message