chicobento commented on a change in pull request #1096:
URL: https://github.com/apache/cassandra/pull/1096#discussion_r662252328



##########
File path: src/java/org/apache/cassandra/service/ClientState.java
##########
@@ -100,8 +100,8 @@
             }
             catch (Exception e)
             {
-                JVMStabilityInspector.inspectThrowable(e);
-                logger.info("Cannot use class {} as query handler ({}), 
ignoring by defaulting on normal query handling", customHandlerClass, 
e.getMessage());
+                logger.error("Cannot use class {} as query handler ({})", 
customHandlerClass, e.getMessage());

Review comment:
       In our case, the exception thrown by the QueryHandler is a cassandra 
ConfigurationException, which has nested exception that gives valuable 
information to the user. 
   In that sense, I'd recommend to pass the whole exception to the logger 
rather than just the message, like:
   `
   logger.error("Cannot use class {} as query handler ({})", 
customHandlerClass, e);
   `

##########
File path: src/java/org/apache/cassandra/service/ClientState.java
##########
@@ -100,8 +100,8 @@
             }
             catch (Exception e)
             {
-                JVMStabilityInspector.inspectThrowable(e);
-                logger.info("Cannot use class {} as query handler ({}), 
ignoring by defaulting on normal query handling", customHandlerClass, 
e.getMessage());
+                logger.error("Cannot use class {} as query handler ({})", 
customHandlerClass, e.getMessage());
+                JVMStabilityInspector.killCurrentJVM(e, false);

Review comment:
       Since the contextualized exception is already being logged above and the 
root cause is well known, I think quiet parameter could be **true**, otherwise 
it will print the stackTrace to System.err and to the logger.error "JVM state 
determined to be unstable.  Exiting forcefully due to:" which is not really 
necessary in this case.
   
   Overall, this is how Im currently handling this situation in my custom query 
handler:
   ```
   MyQueryHandler() {
      try {
        configure();
      } catch (ConfigurationException e) {
        log.error("Error registering MyQueryHandler", e);
        JVMStabilityInspector.killCurrentJVM(e, true);
      }
   }
   ```




-- 
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