You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ja...@apache.org on 2010/02/01 07:43:48 UTC
svn commit: r905188 -
/incubator/cassandra/trunk/contrib/mutex/src/org/apache/cassandra/mutex/ClusterMutex.java
Author: jaakko
Date: Mon Feb 1 06:43:47 2010
New Revision: 905188
URL: http://svn.apache.org/viewvc?rev=905188&view=rev
Log:
handle empty lock root properly. CASSANDRA-704
Modified:
incubator/cassandra/trunk/contrib/mutex/src/org/apache/cassandra/mutex/ClusterMutex.java
Modified: incubator/cassandra/trunk/contrib/mutex/src/org/apache/cassandra/mutex/ClusterMutex.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/contrib/mutex/src/org/apache/cassandra/mutex/ClusterMutex.java?rev=905188&r1=905187&r2=905188&view=diff
==============================================================================
--- incubator/cassandra/trunk/contrib/mutex/src/org/apache/cassandra/mutex/ClusterMutex.java (original)
+++ incubator/cassandra/trunk/contrib/mutex/src/org/apache/cassandra/mutex/ClusterMutex.java Mon Feb 1 06:43:47 2010
@@ -70,7 +70,7 @@
private long lastConnect = 0;
private ZooKeeper zk = null;
- private String root = null;
+ private String root = "";
private Integer mutex = null;
private String hostString = new String();
@@ -78,7 +78,8 @@
private ClusterMutex()
{
String zooKeeperRoot = DatabaseDescriptor.getZooKeeperRoot();
- this.root = "/" + ((zooKeeperRoot != null) ? zooKeeperRoot : "");
+ if (zooKeeperRoot != null && !zooKeeperRoot.isEmpty())
+ root = "/" + zooKeeperRoot;
mutex = new Integer(1);
String zooKeeperPort = DatabaseDescriptor.getZooKeeperPort();
@@ -94,7 +95,7 @@
try
{
connectZooKeeper();
- if (zk.exists(root, false) == null)
+ if (!root.isEmpty() && zk.exists(root, false) == null)
{
logger.info("Mutex root " + root + " does not exists, creating");
zk.create(root, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);