hadoop-zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maha...@apache.org
Subject svn commit: r718447 - in /hadoop/zookeeper/branches/branch-3.0: CHANGES.txt src/java/test/org/apache/zookeeper/test/WatcherTest.java
Date Tue, 18 Nov 2008 00:12:23 GMT
Author: mahadev
Date: Mon Nov 17 16:12:23 2008
New Revision: 718447

URL: http://svn.apache.org/viewvc?rev=718447&view=rev
Log:
ZOOKEEPER-219. fix events.poll timeout in watcher test to be longer. (pat via mahadev)

Modified:
    hadoop/zookeeper/branches/branch-3.0/CHANGES.txt
    hadoop/zookeeper/branches/branch-3.0/src/java/test/org/apache/zookeeper/test/WatcherTest.java

Modified: hadoop/zookeeper/branches/branch-3.0/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.0/CHANGES.txt?rev=718447&r1=718446&r2=718447&view=diff
==============================================================================
--- hadoop/zookeeper/branches/branch-3.0/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.0/CHANGES.txt Mon Nov 17 16:12:23 2008
@@ -13,6 +13,9 @@
    ZOOKEEPER-213. fix programmer guide C api docs to be  in sync with latest
 zookeeper.h (pat via mahadev)
 
+   ZOOKEEPER-219. fix events.poll timeout in watcher test to be longer. (pat
+via mahadev)
+
 Release 3.0.0 - 2008-10-21
 
 Non-backward compatible changes:

Modified: hadoop/zookeeper/branches/branch-3.0/src/java/test/org/apache/zookeeper/test/WatcherTest.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.0/src/java/test/org/apache/zookeeper/test/WatcherTest.java?rev=718447&r1=718446&r2=718447&view=diff
==============================================================================
--- hadoop/zookeeper/branches/branch-3.0/src/java/test/org/apache/zookeeper/test/WatcherTest.java
(original)
+++ hadoop/zookeeper/branches/branch-3.0/src/java/test/org/apache/zookeeper/test/WatcherTest.java
Mon Nov 17 16:12:23 2008
@@ -61,7 +61,7 @@
      * case verifies that we see all of the data events on a particular node.
      * There was a bug (ZOOKEEPER-137) that resulted in events being dropped
      * in some cases (timing).
-     * 
+     *
      * @throws IOException
      * @throws InterruptedException
      * @throws KeeperException
@@ -74,7 +74,7 @@
         try {
             MyWatcher watcher = new MyWatcher();
             zk = createClient(watcher, hostPort);
-            
+
             StatCallback scb = new StatCallback() {
                 public void processResult(int rc, String path, Object ctx,
                         Stat stat) {
@@ -86,20 +86,20 @@
                     // don't do anything
                 }
             };
-            
+
             String names[] = new String[10];
             for (int i = 0; i < names.length; i++) {
                 String name = zk.create("/tc-", "initialvalue".getBytes(),
                         Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL);
                 names[i] = name;
-    
+
                 Stat stat = new Stat();
                 zk.getData(name, watcher, stat);
                 zk.setData(name, "new".getBytes(), stat.getVersion(), scb, null);
                 stat = zk.exists(name, watcher);
                 zk.delete(name, stat.getVersion(), vcb, null);
             }
-            
+
             for (int i = 0; i < names.length; i++) {
                 String name = names[i];
                 WatchedEvent event = watcher.events.poll(10, TimeUnit.SECONDS);
@@ -126,7 +126,7 @@
         testWatcherAutoReset(zk, watcher, watcher);
         zk.close();
     }
-        
+
     @Test
     public void testWatcherAutoResetWithLocal() throws Exception {
         ZooKeeper zk = null;
@@ -135,20 +135,20 @@
         testWatcherAutoReset(zk, watcher, new MyWatcher());
         zk.close();
     }
-        
+
     @Test
     public void testWatcherAutoResetDisabledWithGlobal() throws Exception {
         ClientCnxn.disableAutoWatchReset = true;
         testWatcherAutoResetWithGlobal();
     }
-        
+
     @Test
     public void testWatcherAutoResetDisabledWithLocal() throws Exception {
         ClientCnxn.disableAutoWatchReset = true;
         testWatcherAutoResetWithLocal();
     }
-        
-    private void testWatcherAutoReset(ZooKeeper zk, MyWatcher globalWatcher, 
+
+    private void testWatcherAutoReset(ZooKeeper zk, MyWatcher globalWatcher,
             MyWatcher localWatcher) throws Exception {
         boolean isGlobal = (localWatcher == globalWatcher);
         // First test to see if the watch survives across reconnects
@@ -163,9 +163,9 @@
             zk.getData("/watchtest/child", localWatcher, new Stat());
             zk.exists("/watchtest/child2", localWatcher);
         }
-        
+
         assertTrue(localWatcher.events.isEmpty());
-        
+
         stopServer();
         globalWatcher.waitForDisconnected(3000);
         localWatcher.waitForDisconnected(500);
@@ -174,21 +174,21 @@
         if (!isGlobal && !ClientCnxn.disableAutoWatchReset) {
             localWatcher.waitForConnected(500);
         }
-        
+
         assertTrue(localWatcher.events.isEmpty());
         zk.setData("/watchtest/child", new byte[1], -1);
         zk.create("/watchtest/child2", new byte[0], Ids.OPEN_ACL_UNSAFE,
                 CreateMode.PERSISTENT);
-        
-        WatchedEvent e = localWatcher.events.poll(1, TimeUnit.MILLISECONDS);
+
+        WatchedEvent e = localWatcher.events.poll(10, TimeUnit.SECONDS);
         if (!ClientCnxn.disableAutoWatchReset) {
             assertEquals(e.getPath(), EventType.NodeDataChanged, e.getType());
             assertEquals("/watchtest/child", e.getPath());
         } else {
             assertNull("unexpected event", e);
         }
-    
-        e = localWatcher.events.poll(1000, TimeUnit.MILLISECONDS);
+
+        e = localWatcher.events.poll(10, TimeUnit.SECONDS);
         if (!ClientCnxn.disableAutoWatchReset) {
             // The create will trigger the get children and the exist
             // watches
@@ -198,17 +198,17 @@
             assertNull("unexpected event", e);
         }
 
-        e = localWatcher.events.poll(1000, TimeUnit.MILLISECONDS);
+        e = localWatcher.events.poll(10, TimeUnit.SECONDS);
         if (!ClientCnxn.disableAutoWatchReset) {
             assertEquals(EventType.NodeChildrenChanged, e.getType());
             assertEquals("/watchtest", e.getPath());
         } else {
             assertNull("unexpected event", e);
         }
-        
+
         // Make sure PINGs don't screw us up!
         Thread.sleep(4000);
-        
+
         assertTrue(localWatcher.events.isEmpty()); // ensure no late arrivals
         stopServer();
         globalWatcher.waitForDisconnected(3000);
@@ -230,7 +230,7 @@
         }
         startServer();
         globalWatcher.waitForConnected(3000);
-        
+
         if (isGlobal) {
             zk.getChildren("/watchtest", true);
             zk.getData("/watchtest/child", true, new Stat());
@@ -240,21 +240,21 @@
             zk.getData("/watchtest/child", localWatcher, new Stat());
             zk.exists("/watchtest/child2", localWatcher);
         }
-        
+
         // Do trigger an event to make sure that we do not get
         // it later
         zk.delete("/watchtest/child2", -1);
-        
-        e = localWatcher.events.poll(1, TimeUnit.MILLISECONDS);
+
+        e = localWatcher.events.poll(10, TimeUnit.SECONDS);
         assertEquals(EventType.NodeDeleted, e.getType());
         assertEquals("/watchtest/child2", e.getPath());
-        
-        e = localWatcher.events.poll(1, TimeUnit.MILLISECONDS);
+
+        e = localWatcher.events.poll(10, TimeUnit.SECONDS);
         assertEquals(EventType.NodeChildrenChanged, e.getType());
         assertEquals("/watchtest", e.getPath());
-        
+
         assertTrue(localWatcher.events.isEmpty());
-        
+
         stopServer();
         globalWatcher.waitForDisconnected(3000);
         localWatcher.waitForDisconnected(500);
@@ -263,22 +263,22 @@
         if (!isGlobal && !ClientCnxn.disableAutoWatchReset) {
             localWatcher.waitForConnected(500);
         }
-        
+
         zk.delete("/watchtest/child", -1);
         zk.delete("/watchtest", -1);
-        
-        e = localWatcher.events.poll(1, TimeUnit.MILLISECONDS);
+
+        e = localWatcher.events.poll(10, TimeUnit.SECONDS);
         if (!ClientCnxn.disableAutoWatchReset) {
             assertEquals(EventType.NodeDeleted, e.getType());
             assertEquals("/watchtest/child", e.getPath());
         } else {
             assertNull("unexpected event", e);
         }
-        
+
         // Make sure nothing is straggling!
         Thread.sleep(1000);
         assertTrue(localWatcher.events.isEmpty());
-        
+
     }
 
 }



Mime
View raw message