Github user mbalassi commented on a diff in the pull request:

    https://github.com/apache/flink/pull/813#discussion_r32102450
  
    --- Diff: 
flink-staging/flink-streaming/flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/DataStream.scala
 ---
    @@ -781,11 +780,24 @@ class DataStream[T](javaStream: JavaStream[T]) {
         if (fun == null) {
           throw new NullPointerException("Sink function must not be null.")
         }
    +    val cleanFun = clean(fun)
         val sinkFunction = new SinkFunction[T] {
    -      val cleanFun = clean(fun)
           def invoke(in: T) = cleanFun(in)
         }
         this.addSink(sinkFunction)
       }
     
    +  /**
    +   * Returns a "closure-cleaned" version of the given function. Cleans 
only if closure cleaning
    +   * is not disabled in the {@link 
org.apache.flink.api.common.ExecutionConfig}
    +   */
    +  private[flink] def clean[F <: AnyRef](f: F): F = {
    --- End diff --
    
    Why do we need multiple clean functions? I think scala visibility solves 
that. :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to