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 14:20:13 UTC

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

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



##########
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:
       Indeed, that was why. Since it already conforms to the interface, I didn't realize this would be a public API change. Will revert and overload `checkSupplier` instead.

##########
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:
       We don't _really_ need to. I thought it could make for a better, and also predictable, error message. But maybe just using the implementing class name is fine.




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