Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-18623

The exceptions related to queryNames are inconsistently handled in NodeProbe.java

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Normal
    • Resolution: Unresolved
    • 5.x
    • Legacy/Core
    • None
    • Correctness - API / Semantic Implementation
    • Normal
    • Normal
    • User Report
    • All
    • None

    Description

      The call of queryNames can cause MalformedObjectNameException and IOException, but the exceptions are inconsistently handled. 

      The following method rethrows RuntimeException:

       private static Multimap<String, String> getJmxThreadPools(MBeanServerConnection mbeanServerConn)
      {
       try        
      {            
         Multimap<String, String> threadPools = HashMultimap.create();
         Set<ObjectName> threadPoolObjectNames = mbeanServerConn.queryNames(                    new ObjectName("org.apache.cassandra.metrics:type=ThreadPools,*"),                    null);
            ...
        }catch (MalformedObjectNameException e) {
                throw new RuntimeException("Bad query to JMX server: ", e);        
        }catch (IOException e)        
      {         throw new RuntimeException("Error getting threadpool names from JMX", e);        } 
         

      A method swallows the thrown exceptions:

       public ColumnFamilyStoreMBean getCfsProxy(String ks, String cf)
      {
        ...
      try{
           Set<ObjectName> beans = mbeanServerConn.queryNames(                    new ObjectName("org.apache.cassandra.db:type=*" + type +",keyspace=" + ks + ",columnfamily=" + cf), null);
           ...
      }catch (MalformedObjectNameException mone)        { 
           System.err.println("ColumnFamilyStore for " + ks + "/" + cf + " not found.");            System.exit(1);        
      }catch (IOException e){
           System.err.println("ColumnFamilyStore for " + ks + "/" + cf + " not found: " + e);            System.exit(1);        }
      
         

      A method does not handle it at all:

      private List<Entry<String, ColumnFamilyStoreMBean>> getCFSMBeans(MBeanServerConnection mbeanServerConn, String type)            throws MalformedObjectNameException, IOException
      {
         ...
          ObjectName query = new ObjectName("org.apache.cassandra.db:type=" + type +",*");        Set<ObjectName> cfObjects = mbeanServerConn.queryNames(query, null);
        ...
      }
          

      Attachments

        Activity

          People

            Unassigned Unassigned
            haozhong Hao Zhong
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: