zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ph...@apache.org
Subject svn commit: r1607525 - in /zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java src/java/test/org/apache/zookeeper/test/ReconfigTest.java
Date Thu, 03 Jul 2014 04:01:51 GMT
Author: phunt
Date: Thu Jul  3 04:01:51 2014
New Revision: 1607525

URL: http://svn.apache.org/r1607525
Log:
ZOOKEEPER-1946. Server logging should reflect dynamically reconfigured address (Niko Vuokko
via phunt and Alexander Shraer)

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
    zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ReconfigTest.java

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1607525&r1=1607524&r2=1607525&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Thu Jul  3 04:01:51 2014
@@ -953,6 +953,9 @@ IMPROVEMENTS:
   ZOOKEEPER-1918. Add 64 bit Windows as a supported development
   platform (Michi Mutsuzaki via phunt)
 
+  ZOOKEEPER-1946. Server logging should reflect dynamically
+  reconfigured address (Niko Vuokko via phunt and Alexander Shraer)
+
 headers
 
 Release 3.4.0 - 

Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java?rev=1607525&r1=1607524&r2=1607525&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java (original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java Thu Jul
 3 04:01:51 2014
@@ -854,8 +854,7 @@ public class QuorumPeer extends ZooKeepe
     
     @Override
     public void run() {
-        setName("QuorumPeer" + "[myid=" + getId() + "]" +
-                cnxnFactory.getLocalAddress());
+        updateThreadName();
 
         LOG.debug("Starting quorum peer");
         try {
@@ -1566,6 +1565,7 @@ public class QuorumPeer extends ZooKeepe
            if (myNewQS != null && myNewQS.clientAddr != null
                    && !myNewQS.clientAddr.equals(oldClientAddr)) {
                cnxnFactory.reconfigure(myNewQS.clientAddr);
+               updateThreadName();
            }
            
             boolean roleChange = updateLearnerType(qv);
@@ -1685,4 +1685,8 @@ public class QuorumPeer extends ZooKeepe
         }
     }
 
+    private void updateThreadName() {
+       setName("QuorumPeer" + "[myid=" + getId() + "]" +
+               cnxnFactory.getLocalAddress());
+    }
 }

Modified: zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ReconfigTest.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ReconfigTest.java?rev=1607525&r1=1607524&r2=1607525&view=diff
==============================================================================
--- zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ReconfigTest.java (original)
+++ zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ReconfigTest.java Thu Jul  3 04:01:51
2014
@@ -626,6 +626,8 @@ public class ReconfigTest extends ZKTest
                 .getPort() == port2);
         Assert.assertTrue(qu.getPeer(observerIndex).peer.getClientPort() == port3);
         Assert.assertTrue(qu.getPeer(observerIndex).peer.getPeerState() == ServerState.OBSERVING);
+        Assert.assertTrue(qu.getPeer(observerIndex).peer.getName()
+                .endsWith(String.format(":%d", port3)));
 
         joiningServers.clear();
 



Mime
View raw message