cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r800547 - in /incubator/cassandra/trunk/src/java/org/apache/cassandra: db/ gms/ locator/ net/ net/io/ service/
Date Mon, 03 Aug 2009 20:33:24 GMT
Author: jbellis
Date: Mon Aug  3 20:33:24 2009
New Revision: 800547

URL: http://svn.apache.org/viewvc?rev=800547&view=rev
Log:
brings findbugs count from 266 -> 250 bugs by fixing some scopes, removing some dead code,
and not implementing Serializable unnecessarily.  patch by Michael Greene; reviewed for CASSANDRA-338
by jbellis

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtableManager.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/MinorCompactionManager.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadResponse.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Row.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractStrategy.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/EndPoint.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/StreamContextManager.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtableManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtableManager.java?rev=800547&r1=800546&r2=800547&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtableManager.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryMemtableManager.java
Mon Aug  3 20:33:24 2009
@@ -59,7 +59,7 @@
         return instance_;
     }
     
-    class BinaryMemtableFlusher implements Runnable
+    static class BinaryMemtableFlusher implements Runnable
     {
         private BinaryMemtable memtable_;
         

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=800547&r1=800546&r2=800547&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Mon
Aug  3 20:33:24 2009
@@ -650,12 +650,11 @@
         }
     }
 
-    private PriorityQueue<FileStruct> initializePriorityQueue(List<String> files,
List<Range> ranges, int minBufferSize) throws IOException
+    private PriorityQueue<FileStruct> initializePriorityQueue(List<String> files,
List<Range> ranges) throws IOException
     {
         PriorityQueue<FileStruct> pq = new PriorityQueue<FileStruct>();
         if (files.size() > 1 || (ranges != null && files.size() > 0))
         {
-            int bufferSize = Math.min((ColumnFamilyStore.COMPACTION_MEMORY_THRESHOLD / files.size()),
minBufferSize);
             FileStruct fs = null;
             for (String file : files)
             {
@@ -916,7 +915,7 @@
                           + expectedRangeFileSize + "   is greater than the safe limit of
the disk space available.");
             return result;
         }
-        PriorityQueue<FileStruct> pq = initializePriorityQueue(files, ranges, ColumnFamilyStore.BUFSIZE);
+        PriorityQueue<FileStruct> pq = initializePriorityQueue(files, ranges);
         if (pq.isEmpty())
         {
             return result;
@@ -1080,7 +1079,7 @@
         long totalBytesWritten = 0;
         long totalkeysRead = 0;
         long totalkeysWritten = 0;
-        PriorityQueue<FileStruct> pq = initializePriorityQueue(files, null, minBufferSize);
+        PriorityQueue<FileStruct> pq = initializePriorityQueue(files, null);
 
         if (pq.isEmpty())
         {

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/MinorCompactionManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/MinorCompactionManager.java?rev=800547&r1=800546&r2=800547&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/MinorCompactionManager.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/MinorCompactionManager.java
Mon Aug  3 20:33:24 2009
@@ -66,7 +66,7 @@
         return instance_;
     }
 
-    class FileCompactor2 implements Callable<Boolean>
+    static class FileCompactor2 implements Callable<Boolean>
     {
         private ColumnFamilyStore columnFamilyStore_;
         private List<Range> ranges_;
@@ -100,7 +100,7 @@
         }
     }
 
-    class OnDemandCompactor implements Runnable
+    static class OnDemandCompactor implements Runnable
     {
         private ColumnFamilyStore columnFamilyStore_;
         private long skip_ = 0L;
@@ -128,7 +128,7 @@
         }
     }
 
-    class CleanupCompactor implements Runnable
+    static class CleanupCompactor implements Runnable
     {
         private ColumnFamilyStore columnFamilyStore_;
 

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadResponse.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadResponse.java?rev=800547&r1=800546&r2=800547&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadResponse.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadResponse.java Mon Aug 
3 20:33:24 2009
@@ -22,7 +22,6 @@
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
-import java.io.Serializable;
 import org.apache.cassandra.io.ICompactSerializer;
 import org.apache.cassandra.net.Message;
 import org.apache.cassandra.net.MessagingService;
@@ -36,7 +35,7 @@
  * The table name is needed so that we can use it to create repairs.
  * Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com
)
  */
-public class ReadResponse implements Serializable 
+public class ReadResponse
 {
 private static ICompactSerializer<ReadResponse> serializer_;
 
@@ -134,4 +133,4 @@
         rmsg.setIsDigestQuery(isDigest);
     	return rmsg;
     } 
-}
\ No newline at end of file
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Row.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Row.java?rev=800547&r1=800546&r2=800547&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Row.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Row.java Mon Aug  3 20:33:24
2009
@@ -102,7 +102,6 @@
     void removeColumnFamily(ColumnFamily columnFamily)
     {
         columnFamilies_.remove(columnFamily.name());
-        int delta = (-1) * columnFamily.size();
     }
 
     public boolean isEmpty()

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java?rev=800547&r1=800546&r2=800547&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java Mon Aug  3 20:33:24
2009
@@ -457,7 +457,7 @@
             else
             {
                 /* Gossip with the seed with some probability. */
-                double probability = seeds_.size() / ( liveEndpoints_.size() + unreachableEndpoints_.size()
);
+                double probability = seeds_.size() / (double)( liveEndpoints_.size() + unreachableEndpoints_.size()
);
                 double randDbl = random_.nextDouble();
                 if ( randDbl <= probability )
                     sendGossip(message, seeds_);

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractStrategy.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractStrategy.java?rev=800547&r1=800546&r2=800547&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractStrategy.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/locator/AbstractStrategy.java
Mon Aug  3 20:33:24 2009
@@ -39,7 +39,7 @@
 */
 public abstract class AbstractStrategy implements IReplicaPlacementStrategy
 {
-    protected static Logger logger_ = Logger.getLogger(AbstractStrategy.class);
+    protected static final Logger logger_ = Logger.getLogger(AbstractStrategy.class);
 
     protected TokenMetadata tokenMetadata_;
     protected IPartitioner partitioner_;
@@ -132,4 +132,4 @@
     }
 
     public abstract EndPoint[] getStorageEndPoints(Token token, int offset);
-}
\ No newline at end of file
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/EndPoint.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/EndPoint.java?rev=800547&r1=800546&r2=800547&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/EndPoint.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/EndPoint.java Mon Aug  3 20:33:24
2009
@@ -44,7 +44,7 @@
 
     // use as a kind of magic number to send ourselves a message indicating listening state
     protected static final int sentinelPort_ = 5555;
-    public static EndPoint sentinelLocalEndPoint_;
+    protected static EndPoint sentinelLocalEndPoint_;
     
     static
     {

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java?rev=800547&r1=800546&r2=800547&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java Mon
Aug  3 20:33:24 2009
@@ -456,7 +456,6 @@
     
     public void sendUdpOneWay(Message message, EndPoint to)
     {
-        EndPoint from = message.getFrom();              
         if (message.getFrom().equals(to)) {
             MessagingService.receive(message);
             return;

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/StreamContextManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/StreamContextManager.java?rev=800547&r1=800546&r2=800547&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/StreamContextManager.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/StreamContextManager.java
Mon Aug  3 20:33:24 2009
@@ -128,7 +128,7 @@
         }
     }
     
-    public static class StreamStatus
+    public static class StreamStatus implements Serializable
     {
         private static ICompactSerializer<StreamStatus> serializer_;
         
@@ -253,11 +253,11 @@
     }
         
     /* Maintain a stream context per host that is the source of the stream */
-    public static Map<String, List<StreamContext>> ctxBag_ = new Hashtable<String,
List<StreamContext>>();  
+    public static final Map<String, List<StreamContext>> ctxBag_ = new Hashtable<String,
List<StreamContext>>();  
     /* Maintain in this map the status of the streams that need to be sent back to the source
*/
-    public static Map<String, List<StreamStatus>> streamStatusBag_ = new Hashtable<String,
List<StreamStatus>>();
+    public static final Map<String, List<StreamStatus>> streamStatusBag_ = new
Hashtable<String, List<StreamStatus>>();
     /* Maintains a callback handler per endpoint to notify the app that a stream from a given
endpoint has been handled */
-    public static Map<String, IStreamComplete> streamNotificationHandlers_ = new HashMap<String,
IStreamComplete>();
+    public static final Map<String, IStreamComplete> streamNotificationHandlers_ =
new HashMap<String, IStreamComplete>();
     
     public synchronized static StreamContext getStreamContext(String key)
     {        

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java?rev=800547&r1=800546&r2=800547&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java Mon
Aug  3 20:33:24 2009
@@ -658,7 +658,7 @@
                     allKeys.remove(allKeys.size() - 1);
                     allKeys.addAll(rangeKeys);
                 }
-                else if (rangeKeys.size() > 0)
+                else if (rangeKeys != null && rangeKeys.size() > 0)
                 {
                     allKeys.addAll(rangeKeys);
                 }
@@ -720,4 +720,4 @@
     {
         return writeStats.size();
     }
-}
\ No newline at end of file
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java?rev=800547&r1=800546&r2=800547&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java Mon
Aug  3 20:33:24 2009
@@ -76,7 +76,7 @@
     public final static String mbrshipCleanerVerbHandler_ = "MBRSHIP-CLEANER-VERB-HANDLER";
     public final static String bsMetadataVerbHandler_ = "BS-METADATA-VERB-HANDLER";
     public final static String calloutDeployVerbHandler_ = "CALLOUT-DEPLOY-VERB-HANDLER";
-    public static String rangeVerbHandler_ = "RANGE-VERB-HANDLER";
+    public final static String rangeVerbHandler_ = "RANGE-VERB-HANDLER";
 
     public static enum ConsistencyLevel
     {



Mime
View raw message