cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r826078 - in /incubator/cassandra/trunk: ./ interface/gen-java/org/apache/cassandra/service/ src/java/org/ src/java/org/apache/cassandra/net/ test/unit/org/
Date Fri, 16 Oct 2009 20:40:44 GMT
Author: jbellis
Date: Fri Oct 16 20:40:44 2009
New Revision: 826078

URL: http://svn.apache.org/viewvc?rev=826078&view=rev
Log:
merge from 0.4

Modified:
    incubator/cassandra/trunk/   (props changed)
    incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java
  (props changed)
    incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Column.java
  (props changed)
    incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java
  (props changed)
    incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/NotFoundException.java
  (props changed)
    incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumn.java
  (props changed)
    incubator/cassandra/trunk/src/java/org/   (props changed)
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnectionManager.java
    incubator/cassandra/trunk/test/unit/org/   (props changed)

Propchange: incubator/cassandra/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 16 20:40:44 2009
@@ -1,2 +1,2 @@
 /incubator/cassandra/branches/cassandra-0.3:774578-796573
-/incubator/cassandra/branches/cassandra-0.4:810145-825332
+/incubator/cassandra/branches/cassandra-0.4:810145-826077

Propchange: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 16 20:40:44 2009
@@ -1,3 +1,3 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/Cassandra.java:774578-796573
-/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Cassandra.java:810145-825332
+/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Cassandra.java:810145-826077
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Cassandra.java:749219-768588

Propchange: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Column.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 16 20:40:44 2009
@@ -1,4 +1,4 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/column_t.java:774578-792198
-/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Column.java:810145-825332
+/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/Column.java:810145-826077
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/Column.java:749219-794428
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/column_t.java:749219-768588

Propchange: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 16 20:40:44 2009
@@ -1,3 +1,3 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:774578-796573
-/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:810145-825332
+/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:810145-826077
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/InvalidRequestException.java:749219-768588

Propchange: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/NotFoundException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 16 20:40:44 2009
@@ -1,3 +1,3 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:774578-796573
-/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:810145-825332
+/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:810145-826077
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/NotFoundException.java:749219-768588

Propchange: incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumn.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 16 20:40:44 2009
@@ -1,4 +1,4 @@
 /incubator/cassandra/branches/cassandra-0.3/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:774578-792198
-/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:810145-825332
+/incubator/cassandra/branches/cassandra-0.4/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:810145-826077
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/SuperColumn.java:749219-794428
 /incubator/cassandra/trunk/interface/gen-java/org/apache/cassandra/service/superColumn_t.java:749219-768588

Propchange: incubator/cassandra/trunk/src/java/org/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 16 20:40:44 2009
@@ -1,3 +1,3 @@
 /incubator/cassandra/branches/cassandra-0.3/src/java/org:774578-796573
-/incubator/cassandra/branches/cassandra-0.4/src/java/org:810145-825332
+/incubator/cassandra/branches/cassandra-0.4/src/java/org:810145-826077
 /incubator/cassandra/trunk/src/java/org:749219-769885

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnectionManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnectionManager.java?rev=826078&r1=826077&r2=826078&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnectionManager.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnectionManager.java
Fri Oct 16 20:40:44 2009
@@ -20,7 +20,6 @@
 
 import java.io.IOException;
 import java.util.*;
-import java.util.concurrent.*;
 import java.util.concurrent.locks.*;
 
 import org.apache.log4j.Logger;
@@ -36,7 +35,7 @@
     private int maxSize_;
     private long lastTimeUsed_;
     private boolean isShut_;
-    
+
     private int inUse_;
 
     TcpConnectionManager(int initialSize, int growthFactor, int maxSize, EndPoint localEp,
EndPoint remoteEp)
@@ -45,34 +44,34 @@
         growthFactor_ = growthFactor;
         maxSize_ = maxSize;
         localEp_ = localEp;
-        remoteEp_ = remoteEp;     
-        isShut_ = false;                
-        lastTimeUsed_ = System.currentTimeMillis();        
-        allConnections_ = new Vector<TcpConnection>(); 
+        remoteEp_ = remoteEp;
+        isShut_ = false;
+        lastTimeUsed_ = System.currentTimeMillis();
+        allConnections_ = new ArrayList<TcpConnection>();
     }
-    
+
     TcpConnection getConnection() throws IOException
     {
         lock_.lock();
         try
         {
-            if (allConnections_.isEmpty()) 
-            {                
+            if (allConnections_.isEmpty())
+            {
                 TcpConnection conn = new TcpConnection(this, localEp_, remoteEp_);
                 addToPool(conn);
                 conn.inUse_ = true;
                 incUsed();
                 return conn;
             }
-            
+
             TcpConnection least = getLeastLoaded();
-            
+
             if ( (least != null && least.pending() == 0) || allConnections_.size()
== maxSize_) {
                 least.inUse_ = true;
                 incUsed();
                 return least;
             }
-                                    
+
             TcpConnection connection = new TcpConnection(this, localEp_, remoteEp_);
             if ( connection != null && !contains(connection) )
             {
@@ -84,7 +83,7 @@
             else
             {
                 if ( connection != null )
-                {                
+                {
                     connection.closeSocket();
                 }
                 return getLeastLoaded();
@@ -95,9 +94,9 @@
             lock_.unlock();
         }
     }
-    
-    protected TcpConnection getLeastLoaded() 
-    {  
+
+    protected TcpConnection getLeastLoaded()
+    {
         TcpConnection connection = null;
         lock_.lock();
         try
@@ -111,42 +110,49 @@
         }
         return connection;
     }
-    
+
     void removeConnection(TcpConnection connection)
     {
-        allConnections_.remove(connection);        
+        lock_.lock();
+        try
+        {
+            allConnections_.remove(connection);
+        }
+        finally
+        {
+            lock_.unlock();
+        }
     }
-    
+
     void incUsed()
     {
         inUse_++;
     }
-    
+
     void decUsed()
-    {        
+    {
         inUse_--;
     }
-    
+
     int getConnectionsInUse()
     {
         return inUse_;
     }
 
     void addToPool(TcpConnection connection)
-    { 
-        
-        if ( contains(connection) )
-            return;
-        
+    {
         lock_.lock();
         try
         {
+            if ( contains(connection) )
+                return;
+
             if ( allConnections_.size() < maxSize_ )
-            {                 
-                allConnections_.add(connection);                
+            {
+                allConnections_.add(connection);
             }
             else
-            {                
+            {
                 connection.closeSocket();
             }
         }
@@ -155,15 +161,15 @@
             lock_.unlock();
         }
     }
-    
+
     void shutdown()
-    {    
+    {
         lock_.lock();
         try
         {
             while ( allConnections_.size() > 0 )
             {
-                TcpConnection connection = allConnections_.remove(0);                   
    
+                TcpConnection connection = allConnections_.remove(0);
                 connection.closeSocket();
             }
         }
@@ -176,19 +182,27 @@
 
     int getPoolSize()
     {
-        return allConnections_.size();
+        lock_.lock();
+        try
+        {
+            return allConnections_.size();
+        }
+        finally
+        {
+            lock_.unlock();
+        }
     }
 
     EndPoint getLocalEndPoint()
     {
         return localEp_;
     }
-    
+
     EndPoint getRemoteEndPoint()
     {
         return remoteEp_;
     }
-    
+
     int getPendingWrites()
     {
         int total = 0;
@@ -206,13 +220,17 @@
         }
         return total;
     }
-    
+
     boolean contains(TcpConnection connection)
     {
-        return allConnections_.contains(connection);
-    }
-    List<TcpConnection> getConnections()
-    {
-        return allConnections_;
+        lock_.lock();
+        try
+        {
+            return allConnections_.contains(connection);
+        }
+        finally
+        {
+            lock_.unlock();
+        }
     }
 }

Propchange: incubator/cassandra/trunk/test/unit/org/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 16 20:40:44 2009
@@ -1,3 +1,3 @@
 /incubator/cassandra/branches/cassandra-0.3/test/unit/org:774578-796573
-/incubator/cassandra/branches/cassandra-0.4/test/unit/org:810145-825332
+/incubator/cassandra/branches/cassandra-0.4/test/unit/org:810145-826077
 /incubator/cassandra/trunk/test/unit/org:749219-768583



Mime
View raw message