activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r679397 - in /activemq/sandbox/zookeeper/zookeeper-protocols/src: main/java/org/apache/zookeeper/protocols/ test/java/org/apache/zookeeper/protocols/
Date Thu, 24 Jul 2008 12:47:18 GMT
Author: jstrachan
Date: Thu Jul 24 05:47:18 2008
New Revision: 679397

URL: http://svn.apache.org/viewvc?rev=679397&view=rev
Log:
refactor to rename WriteLock to WriteLockProtocol to differentiate from an in JVM Lock implementation
from java.util.concurrent etc.

Added:
    activemq/sandbox/zookeeper/zookeeper-protocols/src/main/java/org/apache/zookeeper/protocols/WriteLockProtocol.java
  (contents, props changed)
      - copied, changed from r679354, activemq/sandbox/zookeeper/zookeeper-protocols/src/main/java/org/apache/zookeeper/protocols/WriteLock.java
    activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/WriteLockProtocolTest.java
  (contents, props changed)
      - copied, changed from r679354, activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/WriteLockTest.java
Modified:
    activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/ZooKeeperTestSupport.java

Copied: activemq/sandbox/zookeeper/zookeeper-protocols/src/main/java/org/apache/zookeeper/protocols/WriteLockProtocol.java
(from r679354, activemq/sandbox/zookeeper/zookeeper-protocols/src/main/java/org/apache/zookeeper/protocols/WriteLock.java)
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-protocols/src/main/java/org/apache/zookeeper/protocols/WriteLockProtocol.java?p2=activemq/sandbox/zookeeper/zookeeper-protocols/src/main/java/org/apache/zookeeper/protocols/WriteLockProtocol.java&p1=activemq/sandbox/zookeeper/zookeeper-protocols/src/main/java/org/apache/zookeeper/protocols/WriteLock.java&r1=679354&r2=679397&rev=679397&view=diff
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-protocols/src/main/java/org/apache/zookeeper/protocols/WriteLock.java
(original)
+++ activemq/sandbox/zookeeper/zookeeper-protocols/src/main/java/org/apache/zookeeper/protocols/WriteLockProtocol.java
Thu Jul 24 05:47:18 2008
@@ -39,8 +39,8 @@
  *
  * @version $Revision: 1.1 $
  */
-public class WriteLock extends ProtocolSupport {
-    private static final Logger LOG = Logger.getLogger(WriteLock.class);
+public class WriteLockProtocol extends ProtocolSupport {
+    private static final Logger LOG = Logger.getLogger(WriteLockProtocol.class);
 
     private final String dir;
     private String id;
@@ -50,7 +50,7 @@
     private byte[] data = {0x12, 0x34};
     private final WhenOwnerListener whenOwnerListener;
 
-    public WriteLock(ZooKeeperFacade zookeeper, String dir, WhenOwnerListener whenOwnerListener)
{
+    public WriteLockProtocol(ZooKeeperFacade zookeeper, String dir, WhenOwnerListener whenOwnerListener)
{
         super(zookeeper);
         this.dir = dir;
 

Propchange: activemq/sandbox/zookeeper/zookeeper-protocols/src/main/java/org/apache/zookeeper/protocols/WriteLockProtocol.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/WriteLockProtocolTest.java
(from r679354, activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/WriteLockTest.java)
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/WriteLockProtocolTest.java?p2=activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/WriteLockProtocolTest.java&p1=activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/WriteLockTest.java&r1=679354&r2=679397&rev=679397&view=diff
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/WriteLockTest.java
(original)
+++ activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/WriteLockProtocolTest.java
Thu Jul 24 05:47:18 2008
@@ -27,12 +27,12 @@
 /**
  * @version $Revision: 1.1 $
  */
-public class WriteLockTest extends ZooKeeperTestSupport {
-    private static final Logger LOG = Logger.getLogger(WriteLockTest.class);
+public class WriteLockProtocolTest extends ZooKeeperTestSupport {
+    private static final Logger LOG = Logger.getLogger(WriteLockProtocolTest.class);
 
     protected int sessionTimeout = 10 * 1000;
     protected String dir = "/" + getClass().getName();
-    protected WriteLock[] nodes;
+    protected WriteLockProtocol[] nodes;
     protected CountDownLatch latch = new CountDownLatch(1);
     private boolean restartServer = true;
 
@@ -45,7 +45,7 @@
     }
 
     protected void runTest(int count) throws Exception {
-        nodes = new WriteLock[count];
+        nodes = new WriteLockProtocol[count];
         for (int i = 0; i < count; i++) {
             final int nodeId = i;
             ZooKeeperFacade keeper = new ZooKeeperFacade("127.0.0.1:2181", sessionTimeout,
new Watcher() {
@@ -53,7 +53,7 @@
                     LOG.info("ZooKeeper Event for znode: " + nodeId + " on path: " + event.getPath()
+ " state: " + event.getState() + " type: " + event.getType());
                 }
             });
-            WriteLock leader = new WriteLock(keeper, dir, new WhenOwnerListener() {
+            WriteLockProtocol leader = new WriteLockProtocol(keeper, dir, new WhenOwnerListener()
{
                 public void whenOwner() {
                     LOG.info(">>>>>>>>>> OWNER ZNode " + nodeId);
                     latch.countDown();
@@ -72,14 +72,14 @@
         // nodes to become the new leader
         latch.await(30, TimeUnit.SECONDS);
 
-        WriteLock first = nodes[0];
+        WriteLockProtocol first = nodes[0];
         dumpNodes(count);
 
         // lets assert that the first election is the leader
         assertTrue("The first znode should be the leader " + first.getId(), first.isOwner());
 
         for (int i = 1; i < count; i++) {
-            WriteLock node = nodes[i];
+            WriteLockProtocol node = nodes[i];
             assertFalse("Node should not be the leader " + node.getId(), node.isOwner());
         }
 
@@ -92,7 +92,7 @@
                 latch.await(30, TimeUnit.SECONDS);
 
                 //Thread.sleep(10000);
-                WriteLock second = nodes[1];
+                WriteLockProtocol second = nodes[1];
 
                 dumpNodes(count);
 
@@ -100,7 +100,7 @@
                 assertTrue("The second znode should be the leader " + second.getId(), second.isOwner());
 
                 for (int i = 2; i < count; i++) {
-                    WriteLock node = nodes[i];
+                    WriteLockProtocol node = nodes[i];
                     assertFalse("Node should not be the leader " + node.getId(), node.isOwner());
                 }
             }
@@ -131,7 +131,7 @@
 
     protected void dumpNodes(int count) {
         for (int i = 0; i < count; i++) {
-            WriteLock node = nodes[i];
+            WriteLockProtocol node = nodes[i];
             System.out.println("node: " + i + " id: " + node.getId() + " is leader: " + node.isOwner());
         }
     }
@@ -140,7 +140,7 @@
     protected void tearDown() throws Exception {
         if (nodes != null) {
             for (int i = 0; i < nodes.length; i++) {
-                WriteLock node = nodes[i];
+                WriteLockProtocol node = nodes[i];
                 if (node != null) {
                     System.out.println("Closing node: " + i);
                     node.close();

Propchange: activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/WriteLockProtocolTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/ZooKeeperTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/ZooKeeperTestSupport.java?rev=679397&r1=679396&r2=679397&view=diff
==============================================================================
--- activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/ZooKeeperTestSupport.java
(original)
+++ activemq/sandbox/zookeeper/zookeeper-protocols/src/test/java/org/apache/zookeeper/protocols/ZooKeeperTestSupport.java
Thu Jul 24 05:47:18 2008
@@ -30,7 +30,7 @@
  * @version $Revision: 1.1 $
  */
 public class ZooKeeperTestSupport extends TestCase {
-    private static final Logger LOG = Logger.getLogger(WriteLockTest.class);
+    private static final Logger LOG = Logger.getLogger(ZooKeeperTestSupport.class);
 
     protected ZooKeeperServer server;
     protected int tickTime = 3000;



Mime
View raw message