cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject [1/6] git commit: Allow overriding cassandra-rackdc.properties location
Date Tue, 29 Apr 2014 17:12:32 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 0a20f5f17 -> 6f919368c
  refs/heads/cassandra-2.1 acf1b1801 -> 04884ebb1
  refs/heads/trunk 64e46285f -> de860026c


Allow overriding cassandra-rackdc.properties location

Patch by Patrick Ziegler, reviewed by brandonwilliams for CASSANDRA-7072


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6f919368
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6f919368
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6f919368

Branch: refs/heads/cassandra-2.0
Commit: 6f919368c87f1c4c3531843fb8f7f5c80d21f51a
Parents: 0a20f5f
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Tue Apr 29 12:05:47 2014 -0500
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Tue Apr 29 12:05:47 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt                                             |  1 +
 .../org/apache/cassandra/locator/SnitchProperties.java  | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f919368/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 50d5896..81eb566 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.8
+ * Allow overriding cassandra-rackdc.properties file (CASSANDRA-7072)
  * Set JMX RMI port to 7199 (CASSANDRA-7087)
  * Use LOCAL_QUORUM for data reads at LOCAL_SERIAL (CASSANDRA-6939)
  * Log a warning for large batches (CASSANDRA-6487)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6f919368/src/java/org/apache/cassandra/locator/SnitchProperties.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/SnitchProperties.java b/src/java/org/apache/cassandra/locator/SnitchProperties.java
index 809a180..a78b2a7 100644
--- a/src/java/org/apache/cassandra/locator/SnitchProperties.java
+++ b/src/java/org/apache/cassandra/locator/SnitchProperties.java
@@ -18,6 +18,7 @@
 package org.apache.cassandra.locator;
 
 import java.io.InputStream;
+import java.net.URL;
 import java.util.Properties;
 
 import org.apache.cassandra.io.util.FileUtils;
@@ -32,14 +33,21 @@ public class SnitchProperties
 
     static
     {
-        InputStream stream = SnitchProperties.class.getClassLoader().getResourceAsStream(RACKDC_PROPERTY_FILENAME);
+        properties = new Properties();
+        InputStream stream = null;
+        String configURL = System.getProperty("cassandra.rackdc.properties");
         try
         {
+            URL url = new URL(configURL);
+            if (configURL == null)
+                url = SnitchProperties.class.getClassLoader().getResource(
+                        "cassandra-rackdc.properties");
+            stream = url.openStream();
             properties.load(stream);
         }
         catch (Exception e)
         {
-            // do not throw exception here, just consider this a incomplete or a empty property
file.
+            // do not throw exception here, just consider this an incomplete or an empty
property file.
             logger.warn("Unable to read " + RACKDC_PROPERTY_FILENAME);
         }
         finally


Mime
View raw message