cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [01/17] git commit: handle-trigger-non-existance patch by Vijay; reviewed by Brandon Williams for CASSANDRA-5826
Date Tue, 06 Aug 2013 21:56:17 GMT
Updated Branches:
  refs/heads/cassandra-1.1 155afa1b7 -> 238139cda
  refs/heads/cassandra-1.2 bcfe352ea -> 27943b117
  refs/heads/cassandra-2.0 ed4a06771 -> 3205c10de
  refs/heads/cassandra-2.0.0 3d95cad4f -> af85f2327
  refs/heads/trunk 885ba119f -> 426caf7c0


handle-trigger-non-existance
patch by Vijay; reviewed by Brandon Williams for CASSANDRA-5826


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

Branch: refs/heads/cassandra-2.0
Commit: 6851c81867f317110487b05b509841f5c159aaf1
Parents: cf62bdc
Author: Vijay Parthasarathy <vijay2win@gmail.com>
Authored: Mon Aug 5 19:45:57 2013 -0700
Committer: Vijay Parthasarathy <vijay2win@gmail.com>
Committed: Mon Aug 5 20:15:36 2013 -0700

----------------------------------------------------------------------
 .../cassandra/triggers/TriggerExecutor.java       |  6 ++++--
 .../org/apache/cassandra/utils/FBUtilities.java   | 18 +++++++++++++-----
 2 files changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6851c818/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/triggers/TriggerExecutor.java b/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
index c6feb84..582a224 100644
--- a/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
+++ b/src/java/org/apache/cassandra/triggers/TriggerExecutor.java
@@ -42,7 +42,6 @@ public class TriggerExecutor
 
     private final Map<String, ITrigger> cachedTriggers = Maps.newConcurrentMap();
     private final ClassLoader parent = Thread.currentThread().getContextClassLoader();
-    private final File triggerDirectory = FBUtilities.cassandraTriggerDir();
     private volatile ClassLoader customClassLoader;
 
     private TriggerExecutor()
@@ -56,7 +55,10 @@ public class TriggerExecutor
      */
     public void reloadClasses()
     {
-        customClassLoader = new CustomClassLoader(parent, triggerDirectory);
+        File tiggerDirectory = FBUtilities.cassandraTriggerDir();
+        if (tiggerDirectory == null)
+            return;
+        customClassLoader = new CustomClassLoader(parent, tiggerDirectory);
         cachedTriggers.clear();
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6851c818/src/java/org/apache/cassandra/utils/FBUtilities.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/FBUtilities.java b/src/java/org/apache/cassandra/utils/FBUtilities.java
index 7873ce7..e5bd71e 100644
--- a/src/java/org/apache/cassandra/utils/FBUtilities.java
+++ b/src/java/org/apache/cassandra/utils/FBUtilities.java
@@ -52,7 +52,6 @@ import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.io.IVersionedSerializer;
 import org.apache.cassandra.io.util.DataOutputBuffer;
-import org.apache.cassandra.io.util.FileUtils;
 import org.apache.cassandra.io.util.IAllocator;
 import org.apache.cassandra.net.AsyncOneResponse;
 import org.apache.thrift.TBase;
@@ -344,13 +343,22 @@ public class FBUtilities
 
     public static File cassandraTriggerDir()
     {
-        File triggerDir;
+        File triggerDir = null;
         if (System.getProperty("cassandra.triggers_dir") != null)
+        {
             triggerDir = new File(System.getProperty("cassandra.triggers_dir"));
+        }
         else
-            triggerDir = new File(FBUtilities.class.getClassLoader().getResource(DEFAULT_TRIGGER_DIR).getFile());
-        if (!triggerDir.exists())
-            throw new RuntimeException("Trigger Directory doesnt exist, please create inside
conf.");
+        {
+            URL confDir = FBUtilities.class.getClassLoader().getResource(DEFAULT_TRIGGER_DIR);
+            if (confDir != null)
+                triggerDir = new File(confDir.getFile());
+        }
+        if (triggerDir == null || !triggerDir.exists())
+        {
+            logger.warn("Trigger Directory doesnt exist, please create it and try again.");
+            return null;
+        }
         return triggerDir;
     }
 


Mime
View raw message