{"record":{"id":"7a222b3543ae472f","repo":"apache/hadoop","slug":"not-supported-yet","errorCode":null,"errorMessage":"Not supported yet.","messagePattern":"Not supported yet\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSourceAdapter.java","lineNumber":151,"sourceCode":"        Attribute attr = attrCache.get(key);\n        if (LOG.isDebugEnabled()) {\n          LOG.debug(key +\": \"+ attr);\n        }\n        ret.add(attr);\n      }\n      return ret;\n    }\n  }\n\n  @Override\n  public AttributeList setAttributes(AttributeList attributes) {\n    throw new UnsupportedOperationException(\"Metrics are read-only.\");\n  }\n\n  @Override\n  public Object invoke(String actionName, Object[] params, String[] signature)\n      throws MBeanException, ReflectionException {\n    throw new UnsupportedOperationException(\"Not supported yet.\");\n  }\n\n  @Override\n  public MBeanInfo getMBeanInfo() {\n    updateJmxCache();\n    return infoCache;\n  }\n\n  private void updateJmxCache() {\n    boolean getAllMetrics = false;\n    synchronized(this) {\n      if (Time.now() - jmxCacheTS >= jmxCacheTTL) {\n        // temporarilly advance the expiry while updating the cache\n        jmxCacheTS = Time.now() + jmxCacheTTL;\n        // lastRecs might have been set to an object already by another thread.\n        // Track the fact that lastRecs has been reset once to make sure refresh\n        // is correctly triggered.\n        if (lastRecsCleared) {","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSourceAdapter.java#L133-L169","documentation":"MetricsSourceAdapter.invoke(String actionName, Object[] params, String[] signature) always throws UnsupportedOperationException('Not supported yet.') — metrics2 MBeans expose attributes only and implement no management operations. Any invoke with any action name produces this error.","triggerScenarios":"MBeanServerConnection.invoke() on a Hadoop metrics MBean with any actionName (e.g., 'reset', 'clear', 'snapshot'); JMX consoles that let users run operations on any selected bean.","commonSituations":"Runbooks written for other beans (e.g., java.lang:type=Memory operations) reused on Hadoop beans; automation that 'resets' metrics through JMX.","solutions":["Drop the invoke call — the bean declares zero operations (getMBeanInfo().getOperations() is empty)","Implement reset behavior in the component or through its admin endpoints instead","Catch UnsupportedOperationException if your tool must generically attempt operations"],"exampleFix":"// before\nmbsc.invoke(objectName, \"reset\", new Object[0], new String[0]);\n\n// after\nif (mbsc.getMBeanInfo(objectName).getOperations().length > 0) {\n  mbsc.invoke(objectName, \"reset\", new Object[0], new String[0]);\n}","handlingStrategy":"validation","validationCode":"MBeanOperationInfo[] ops = mbsc.getMBeanInfo(objectName).getOperations();\nif (ops.length > 0) {  // empty for metrics2 beans\n  mbsc.invoke(objectName, action, params, signature);\n}","typeGuard":null,"tryCatchPattern":"try {\n  mbsc.invoke(objectName, action, params, signature);\n} catch (UnsupportedOperationException e) {\n  // metrics2 beans expose attributes only, no operations\n}","preventionTips":["Check getMBeanInfo().getOperations() before invoking operations on unfamiliar beans","Do not reuse runbooks from operational beans (like MemoryMXBean) on metrics beans","Implement resets in component code or admin endpoints, not via JMX"],"tags":["jmx","metrics2","hadoop","unsupported-operation"],"backgroundTag":"jmx-operation-not-supported","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}