dajac commented on code in PR #24327:
URL: https://github.com/apache/kafka/pull/24327#discussion_r4668205508
##########
coordinator-common/src/main/java/org/apache/kafka/coordinator/common/runtime/CoordinatorOperationExceptionHelper.java:
##########
@@ -37,14 +37,14 @@ public class CoordinatorOperationExceptionHelper {
* transform the error depending on the context.
* @param log The logger.
* @return The output built by the handler.
- * @param <IN> The type of the operation input. It must be a toString'able
object.
- * @param <OUT> The type of the value returned by handler.
+ * @param <Input> The type of the operation input. It must be a
toString'able object.
+ * @param <Output> The type of the value returned by handler.
*/
- public static <IN, OUT> OUT handleOperationException(
+ public static <Input, Output> Output handleOperationException(
Review Comment:
I would not change this here as it is unrelated.
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java:
##########
@@ -2745,6 +2744,42 @@ private OffsetFetchResponseData.OffsetFetchResponseGroup
handleOffsetFetchExcept
};
}
+ /**
+ * This is the handler used by offset commit operations to convert errors
to coordinator errors.
+ * The handler also handles and logs unexpected errors.
+ *
+ * @param operationName The name of the operation.
+ * @param request The request for logging purposes.
+ * @param exception The exception to handle.
+ * @param handler A function which takes an Errors and builds
the response.
+ * @return The response built by the handler.
+ * @param <RequestData> The type of the request. It must be a
toString'able object.
+ * @param <ResponseData> The type of the response.
+ */
+ private <RequestData, ResponseData> ResponseData
handleOffsetCommitException(
+ String operationName,
+ RequestData request,
+ Throwable exception,
+ Function<Errors, ResponseData> handler
Review Comment:
Could we use single-letter type parameters, as in the [Java naming
conventions](https://docs.oracle.com/javase/tutorial/java/generics/types.html)?
`RequestData` and `ResponseData` read like class names. For instance, `T` and
`R` as in `Function<T, R>`.
```suggestion
* @param <T> The type of the request. It must be a toString'able object.
* @param <R> The type of the response.
*/
private <T, R> R handleOffsetCommitException(
String operationName,
T request,
Throwable exception,
Function<Errors, R> handler
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]