apache/hadoop · error · UnsupportedOperationException

Not supported yet.

Error message

Not supported yet.

What it means

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.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSourceAdapter.java:151

        Attribute attr = attrCache.get(key);
        if (LOG.isDebugEnabled()) {
          LOG.debug(key +": "+ attr);
        }
        ret.add(attr);
      }
      return ret;
    }
  }

  @Override
  public AttributeList setAttributes(AttributeList attributes) {
    throw new UnsupportedOperationException("Metrics are read-only.");
  }

  @Override
  public Object invoke(String actionName, Object[] params, String[] signature)
      throws MBeanException, ReflectionException {
    throw new UnsupportedOperationException("Not supported yet.");
  }

  @Override
  public MBeanInfo getMBeanInfo() {
    updateJmxCache();
    return infoCache;
  }

  private void updateJmxCache() {
    boolean getAllMetrics = false;
    synchronized(this) {
      if (Time.now() - jmxCacheTS >= jmxCacheTTL) {
        // temporarilly advance the expiry while updating the cache
        jmxCacheTS = Time.now() + jmxCacheTTL;
        // lastRecs might have been set to an object already by another thread.
        // Track the fact that lastRecs has been reset once to make sure refresh
        // is correctly triggered.
        if (lastRecsCleared) {

View on GitHub (pinned to 2add963021)

Solutions

  1. Drop the invoke call — the bean declares zero operations (getMBeanInfo().getOperations() is empty)
  2. Implement reset behavior in the component or through its admin endpoints instead
  3. Catch UnsupportedOperationException if your tool must generically attempt operations

Example fix

// before
mbsc.invoke(objectName, "reset", new Object[0], new String[0]);

// after
if (mbsc.getMBeanInfo(objectName).getOperations().length > 0) {
  mbsc.invoke(objectName, "reset", new Object[0], new String[0]);
}
Defensive patterns

Strategy: validation

Validate before calling

MBeanOperationInfo[] ops = mbsc.getMBeanInfo(objectName).getOperations();
if (ops.length > 0) {  // empty for metrics2 beans
  mbsc.invoke(objectName, action, params, signature);
}

Try / catch

try {
  mbsc.invoke(objectName, action, params, signature);
} catch (UnsupportedOperationException e) {
  // metrics2 beans expose attributes only, no operations
}

Prevention

When it happens

Trigger: 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.

Common situations: Runbooks written for other beans (e.g., java.lang:type=Memory operations) reused on Hadoop beans; automation that 'resets' metrics through JMX.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/7a222b3543ae472f. Report an issue: GitHub.