{"record":{"id":"3024b1148ec78326","repo":"apache/hadoop","slug":"this-method-is-deprecated-use-the-other-addrespon","errorCode":null,"errorMessage":"This method is deprecated: use the other addResponseTime","messagePattern":"This method is deprecated: use the other addResponseTime","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RpcScheduler.java","lineNumber":54,"sourceCode":"  /**\n   * This method only exists to maintain backwards compatibility with old\n   * implementations. It will not be called by any Hadoop code, and should not\n   * be implemented by new implementations.\n   *\n   * @param name input name.\n   * @param priorityLevel input priorityLevel.\n   * @param queueTime input queueTime.\n   * @param processingTime input processingTime.\n   * @throws UnsupportedOperationException\n   *         the requested operation is not supported.\n   * @deprecated Use\n   * {@link #addResponseTime(String, Schedulable, ProcessingDetails)} instead.\n   */\n  @Deprecated\n  @SuppressWarnings(\"unused\")\n  default void addResponseTime(String name, int priorityLevel, int queueTime,\n      int processingTime) {\n    throw new UnsupportedOperationException(\n        \"This method is deprecated: use the other addResponseTime\");\n  }\n\n  /**\n   * Store a processing time value for an RPC call into this scheduler.\n   *\n   * @param callName The name of the call.\n   * @param schedulable The schedulable representing the incoming call.\n   * @param details The details of processing time.\n   */\n  @SuppressWarnings(\"deprecation\")\n  default void addResponseTime(String callName, Schedulable schedulable,\n      ProcessingDetails details) {\n    // For the sake of backwards compatibility with old implementations of\n    // this interface, a default implementation is supplied which uses the old\n    // method. All new implementations MUST override this interface and should\n    // NOT use the other addResponseTime method.\n    int queueTime = (int) details.get(ProcessingDetails.Timing.QUEUE,","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RpcScheduler.java#L36-L72","documentation":"RpcScheduler's deprecated four-arg addResponseTime(name, priorityLevel, queueTime, processingTime) is a default method whose only behavior is to throw UnsupportedOperationException, pushing callers to the overload addResponseTime(callName, Schedulable, ProcessingDetails). The javadoc states no Hadoop code calls the old method; you hit it when external code invokes the old signature on a scheduler that (correctly, per the contract) implements only the new overload.","triggerScenarios":"Calling the deprecated addResponseTime overload directly on a new-style RpcScheduler implementation that does not override it; scheduler plugins or metrics code compiled against the old signature running against a current implementation; note the inverse works — the new default method delegates to the old one for legacy implementations.","commonSituations":"Hadoop version upgrades where third-party call sites still use the old overload; custom RpcScheduler implementations (custom call-queue backends) tested with old-style harnesses; copy-pasted metrics adapters.","solutions":["Switch the call site to addResponseTime(callName, schedulable, processingDetails) — the ProcessingDetails instance the server already carries.","If external code must keep calling the old signature on your custom scheduler, override the deprecated method in your implementation and translate it into your new-style recording.","Recompile plugin code against the exact deployed Hadoop version so overload resolution matches the running contract."],"exampleFix":"// before\nrpcScheduler.addResponseTime(name, priorityLevel, queueTime, processingTime); // UnsupportedOperationException\n// after\nrpcScheduler.addResponseTime(callName, schedulable, processingDetails);\n\n// if your custom RpcScheduler must keep old callers working:\n@Deprecated\n@Override\npublic void addResponseTime(String name, int priorityLevel, int queueTime, int processingTime) {\n  recordResponseTime(name, queueTime, processingTime); // translate to new-style recording\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Implement both overloads in custom RpcScheduler implementations, with the deprecated one translating into the new-style recording.","Compile scheduler plugins against the exact deployed Hadoop version so overload resolution matches.","Treat the deprecated four-arg addResponseTime as caller-side dead code — Hadoop never invokes it."],"tags":["rpc","scheduler","deprecated","metrics","upgrade"],"backgroundTag":"deprecated-api-misuse","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}