{"record":{"id":"42b8b470050c0b30","repo":"apache/flink","slug":"please-override-the-method","errorCode":null,"errorMessage":"Please override the method.","messagePattern":"Please override the method\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"critical","filePath":"flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/writer/AsyncSinkWriter.java","lineNumber":208,"sourceCode":"     * }\n     *\n     * }</pre>\n     *\n     * <p>During checkpointing, the sink needs to ensure that there are no outstanding in-flight\n     * requests.\n     *\n     * @param requestEntries a set of request entries that should be sent to the destination\n     * @param resultHandler the {@code complete} method should be called on this ResultHandler once\n     *     the processing of the {@code requestEntries} are complete. Any entries that encountered\n     *     difficulties in persisting should be re-queued through {@code retryForEntries} by\n     *     including that element in the collection of {@code RequestEntryT}s passed to the {@code\n     *     retryForEntries} method. All other elements are assumed to have been successfully\n     *     persisted. In case of encountering fatal exceptions, the {@code completeExceptionally}\n     *     method should be called.\n     */\n    protected void submitRequestEntries(\n            List<RequestEntryT> requestEntries, ResultHandler<RequestEntryT> resultHandler) {\n        throw new UnsupportedOperationException(\"Please override the method.\");\n    }\n\n    /**\n     * This method allows the getting of the size of a {@code RequestEntryT} in bytes. The size in\n     * this case is measured as the total bytes that is written to the destination as a result of\n     * persisting this particular {@code RequestEntryT} rather than the serialized length (which may\n     * be the same).\n     *\n     * @param requestEntry the requestEntry for which we want to know the size\n     * @return the size of the requestEntry, as defined previously\n     */\n    protected abstract long getSizeInBytes(RequestEntryT requestEntry);\n\n    /**\n     * This constructor is deprecated. Users should use {@link #AsyncSinkWriter(ElementConverter,\n     * WriterInitContext, AsyncSinkWriterConfiguration, Collection, BatchCreator, RequestBuffer)}.\n     */\n    @Deprecated","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/writer/AsyncSinkWriter.java#L190-L226","documentation":"Thrown as UnsupportedOperationException by the default implementation of submitRequestEntries in AsyncSinkWriter. This method is the core hook that concrete sink writers must override to send buffered request entries to the destination system. The base class provides a non-abstract stub that throws to fail fast if a subclass forgets to implement it.","triggerScenarios":"Subclassing AsyncSinkWriter without overriding submitRequestEntries(List<RequestEntryT>, ResultHandler<RequestEntryT>). When the sink's flush mechanism calls submitRequestEntries at runtime (triggered by buffer size or time threshold), the default stub throws.","commonSituations":"Developer creates a custom async sink by extending AsyncSinkWriter but forgets to implement the submitRequestEntries method; a refactor removes or renames the override; the method signature changed between Flink versions and the override no longer matches.","solutions":["Override submitRequestEntries in your AsyncSinkWriter subclass to send entries to the destination.","Ensure the method signature matches exactly: protected void submitRequestEntries(List<RequestEntryT> requestEntries, ResultHandler<RequestEntryT> resultHandler).","If upgrading Flink versions, check the changelog for signature changes to submitRequestEntries.","Call resultHandler.complete() on success, resultHandler.retryForEntries(...) for retryable failures, or resultHandler.completeExceptionally(...) for fatal errors."],"exampleFix":"// before — missing override\nclass MySinkWriter extends AsyncSinkWriter<String, String> {\n    // no submitRequestEntries override\n}\n// after — implement the method\n@Override\nprotected void submitRequestEntries(List<String> requestEntries, ResultHandler<String> resultHandler) {\n    client.sendBatch(requestEntries)\n        .whenComplete((resp, err) -> {\n            if (err != null) { resultHandler.completeExceptionally(err); }\n            else { resultHandler.complete(); }\n        });\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Verify override exists via reflection (compile-time check is better)\ntry {\n    Method m = writerClass.getDeclaredMethod(\"submitRequestEntries\", List.class, ResultHandler.class);\n    if (m.getDeclaringClass() == AsyncSinkWriter.class) {\n        throw new IllegalStateException(writerClass.getName() + \" must override submitRequestEntries\");\n    }\n} catch (NoSuchMethodException e) {\n    throw new IllegalStateException(\"submitRequestEntries not found\", e);\n}","tryCatchPattern":null,"preventionTips":["Always override submitRequestEntries when extending AsyncSinkWriter.","Use @Override annotation to catch signature mismatches at compile time.","Check Flink changelog for method signature changes when upgrading."],"tags":["async-sink","missing-override","api-contract","programming-error"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}