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
- 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
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
- 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
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
- Metrics are read-only.
- {} not found
- {} already exists!
- {getClass().getSimpleName()} doesn't support truncate
- Append is not supported by ChecksumFileSystem
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/7a222b3543ae472f.
Report an issue: GitHub.