dawidwys commented on a change in pull request #12147:
URL: https://github.com/apache/flink/pull/12147#discussion_r425845726



##########
File path: 
flink-core/src/main/java/org/apache/flink/api/common/eventtime/TimestampAssignerSupplier.java
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.api.common.eventtime;
+
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.api.java.ClosureCleaner;
+import org.apache.flink.metrics.MetricGroup;
+
+import java.io.Serializable;
+
+/**
+ * A supplier for {@link TimestampAssigner TimestampAssigners}. The supplier 
pattern is used to
+ * avoid having to make {@link TimestampAssigner} {@link Serializable} for use 
in API methods.
+ */
+@PublicEvolving
+@FunctionalInterface
+public interface TimestampAssignerSupplier<T> extends Serializable {
+
+       /**
+        * Instantiates a {@link TimestampAssigner}.
+        */
+       TimestampAssigner<T> createTimestampAssigner(Context context);
+
+       static <T> TimestampAssignerSupplier<T> 
of(SerializableTimestampAssigner<T> assigner) {
+               return new 
SupplierFromSerializableTimestampAssigner<>(assigner);
+       }
+
+       /**
+        * Additional information available to {@link 
#createTimestampAssigner(Context)}. This can be
+        * access to {@link org.apache.flink.metrics.MetricGroup MetricGroups}, 
for example.
+        */
+       interface Context {
+
+               /**
+                * Returns the metric group for the parallel subtask of the 
operator that will use the

Review comment:
       parallel subtask or shard/partition?




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to