aratno commented on code in PR #3240:
URL: https://github.com/apache/cassandra/pull/3240#discussion_r1558786569


##########
src/java/org/apache/cassandra/triggers/TriggerExecutor.java:
##########
@@ -252,8 +272,23 @@ private List<Mutation> executeInternal(PartitionUpdate 
update)
         }
     }
 
+    public synchronized void loadTriggerClass(String triggerClass) throws 
Exception
+    {
+        // Allow loading the class regardless of Config, since this could 
happen as part of TCM replay via
+        // CreateTriggerStatement#apply.
+        // Check that triggerClass is available on the classpath, but do not 
initialize the class since that would
+        // execute static blocks.
+        customClassLoader.loadClass(triggerClass).getConstructor();
+    }
+
     public synchronized ITrigger loadTriggerInstance(String triggerClass) 
throws Exception
     {
+        Config.TriggersPolicy policy = DatabaseDescriptor.getTriggersPolicy();
+        if (policy == Config.TriggersPolicy.disabled || policy == 
Config.TriggersPolicy.forbidden)

Review Comment:
   I could, it's a personal style preference to have enum checks be exhaustive 
/ explicit. I find that it makes usage of each enum value easier to understand. 
I'd do `!=` if there were so many fields it felt wrong to list.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to