cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r794079 - in /incubator/cassandra/trunk/src/java/org/apache/cassandra/net: EndPoint.java TcpConnection.java
Date Tue, 14 Jul 2009 21:46:44 GMT
Author: jbellis
Date: Tue Jul 14 21:46:43 2009
New Revision: 794079

URL: http://svn.apache.org/viewvc?rev=794079&view=rev
Log:
rename confusing "random" magic number variables.  patch by jbellis; reviewed by Michael Greene
for CASSANDRA-74

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/EndPoint.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java

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=794079&r1=794078&r2=794079&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 Tue Jul 14 21:46:43
2009
@@ -41,14 +41,16 @@
     private static Logger logger_ = Logger.getLogger(EndPoint.class);
     private static final long serialVersionUID = -4962625949179835907L;
     private static Map<CharBuffer, String> hostNames_ = new HashMap<CharBuffer,
String>();
-    protected static final int randomPort_ = 5555;
-    public static EndPoint randomLocalEndPoint_;
+
+    // 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_;
     
     static
     {
         try
         {
-            randomLocalEndPoint_ = new EndPoint(FBUtilities.getHostAddress(), EndPoint.randomPort_);
+            sentinelLocalEndPoint_ = new EndPoint(FBUtilities.getHostAddress(), EndPoint.sentinelPort_);
         }        
         catch ( IOException ex )
         {

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java?rev=794079&r1=794078&r2=794079&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java Tue Jul
14 21:46:43 2009
@@ -168,7 +168,7 @@
         byte[] data = serializer_.serialize(message);        
         if ( data.length > 0 )
         {    
-            boolean listening = !message.getFrom().equals(EndPoint.randomLocalEndPoint_);
+            boolean listening = !message.getFrom().equals(EndPoint.sentinelLocalEndPoint_);
             ByteBuffer buffer = MessagingService.packIt( data , false, false, listening);
  
             synchronized(this)
             {
@@ -460,7 +460,7 @@
                         /* first message received */
                         if (remoteEp_ == null)
                         {             
-                            int port = ( pH.isListening_ ) ? DatabaseDescriptor.getStoragePort()
: EndPoint.randomPort_;
+                            int port = ( pH.isListening_ ) ? DatabaseDescriptor.getStoragePort()
: EndPoint.sentinelPort_;
                             remoteEp_ = new EndPoint( socketChannel_.socket().getInetAddress().getHostAddress(),
port );                            
                             // put connection into pool if possible
                             pool_ = MessagingService.getConnectionPool(localEp_, remoteEp_);
                           



Mime
View raw message