You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/11/03 13:47:45 UTC

[GitHub] [kafka] mjsax commented on a change in pull request #9000: KAFKA-10036 Improve handling and documentation of Suppliers

mjsax commented on a change in pull request #9000:
URL: https://github.com/apache/kafka/pull/9000#discussion_r516239935



##########
File path: streams/src/main/java/org/apache/kafka/streams/kstream/ValueTransformerSupplier.java
##########
@@ -33,12 +38,17 @@
  * @see TransformerSupplier
  * @see KStream#transform(TransformerSupplier, String...)
  */
-public interface ValueTransformerSupplier<V, VR> extends ConnectedStoreProvider {
+public interface ValueTransformerSupplier<V, VR> extends ConnectedStoreProvider, Supplier<ValueTransformer<V, VR>> {

Review comment:
       This seems to be a public API change that we cannot do without a KIP. Seem you added it so you can pass the different suppliers into `checkSupplier` ? Also not sure if `checkSupplier` must be as "complicated" as proposed.

##########
File path: streams/src/main/java/org/apache/kafka/streams/internals/ApiUtils.java
##########
@@ -75,4 +81,31 @@ public static long validateMillisecondInstant(final Instant instant, final Strin
     public static String prepareMillisCheckFailMsgPrefix(final Object value, final String name) {
         return format(MILLISECOND_VALIDATION_FAIL_MSG_FRMT, name, value);
     }
+
+    /**
+     * @throws IllegalArgumentException if the same instance is obtained each time
+     */
+    public static void checkSupplier(final Supplier<?> supplier) {
+        if (supplier.get() == supplier.get()) {
+            final String supplierClass = getAllImplementedInterfaces(supplier.getClass()).stream()

Review comment:
       Do we really need to try to extract the concrete interface name?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org