@@ -414,40 +414,99 @@ class JavaSparkContext(val sc: SparkContext) extends JavaSparkContextVarargsWork
414414 def intAccumulator (initialValue : Int ): Accumulator [java.lang.Integer ] =
415415 sc.accumulator(initialValue)(IntAccumulatorParam ).asInstanceOf [Accumulator [java.lang.Integer ]]
416416
417+ /**
418+ * Create an [[org.apache.spark.Accumulator ]] integer variable, which tasks can "add" values
419+ * to using the `add` method. Only the master can access the accumulator's `value`.
420+ *
421+ * This version supports naming the accumulator for display in Spark's web UI.
422+ */
423+ def intAccumulator (initialValue : Int , name : String ): Accumulator [java.lang.Integer ] =
424+ sc.accumulator(initialValue, name)(IntAccumulatorParam )
425+ .asInstanceOf [Accumulator [java.lang.Integer ]]
426+
417427 /**
418428 * Create an [[org.apache.spark.Accumulator ]] double variable, which tasks can "add" values
419429 * to using the `add` method. Only the master can access the accumulator's `value`.
420430 */
421431 def doubleAccumulator (initialValue : Double ): Accumulator [java.lang.Double ] =
422432 sc.accumulator(initialValue)(DoubleAccumulatorParam ).asInstanceOf [Accumulator [java.lang.Double ]]
423433
434+ /**
435+ * Create an [[org.apache.spark.Accumulator ]] double variable, which tasks can "add" values
436+ * to using the `add` method. Only the master can access the accumulator's `value`.
437+ *
438+ * This version supports naming the accumulator for display in Spark's web UI.
439+ */
440+ def doubleAccumulator (initialValue : Double , name : String ): Accumulator [java.lang.Double ] =
441+ sc.accumulator(initialValue, name)(DoubleAccumulatorParam )
442+ .asInstanceOf [Accumulator [java.lang.Double ]]
443+
424444 /**
425445 * Create an [[org.apache.spark.Accumulator ]] integer variable, which tasks can "add" values
426446 * to using the `add` method. Only the master can access the accumulator's `value`.
427447 */
428448 def accumulator (initialValue : Int ): Accumulator [java.lang.Integer ] = intAccumulator(initialValue)
429449
450+ /**
451+ * Create an [[org.apache.spark.Accumulator ]] integer variable, which tasks can "add" values
452+ * to using the `add` method. Only the master can access the accumulator's `value`.
453+ *
454+ * This version supports naming the accumulator for display in Spark's web UI.
455+ */
456+ def accumulator (initialValue : Int , name : String ): Accumulator [java.lang.Integer ] =
457+ intAccumulator(initialValue, name)
458+
430459 /**
431460 * Create an [[org.apache.spark.Accumulator ]] double variable, which tasks can "add" values
432461 * to using the `add` method. Only the master can access the accumulator's `value`.
433462 */
434463 def accumulator (initialValue : Double ): Accumulator [java.lang.Double ] =
435464 doubleAccumulator(initialValue)
436465
466+
467+ /**
468+ * Create an [[org.apache.spark.Accumulator ]] double variable, which tasks can "add" values
469+ * to using the `add` method. Only the master can access the accumulator's `value`.
470+ *
471+ * This version supports naming the accumulator for display in Spark's web UI.
472+ */
473+ def accumulator (initialValue : Double , name : String ): Accumulator [java.lang.Double ] =
474+ doubleAccumulator(initialValue, name)
475+
437476 /**
438477 * Create an [[org.apache.spark.Accumulator ]] variable of a given type, which tasks can "add"
439478 * values to using the `add` method. Only the master can access the accumulator's `value`.
440479 */
441480 def accumulator [T ](initialValue : T , accumulatorParam : AccumulatorParam [T ]): Accumulator [T ] =
442481 sc.accumulator(initialValue)(accumulatorParam)
443482
483+ /**
484+ * Create an [[org.apache.spark.Accumulator ]] variable of a given type, which tasks can "add"
485+ * values to using the `add` method. Only the master can access the accumulator's `value`.
486+ *
487+ * This version supports naming the accumulator for display in Spark's web UI.
488+ */
489+ def accumulator [T ](initialValue : T , name : String , accumulatorParam : AccumulatorParam [T ])
490+ : Accumulator [T ] =
491+ sc.accumulator(initialValue, name)(accumulatorParam)
492+
444493 /**
445494 * Create an [[org.apache.spark.Accumulable ]] shared variable of the given type, to which tasks
446495 * can "add" values with `add`. Only the master can access the accumuable's `value`.
447496 */
448497 def accumulable [T , R ](initialValue : T , param : AccumulableParam [T , R ]): Accumulable [T , R ] =
449498 sc.accumulable(initialValue)(param)
450499
500+ /**
501+ * Create an [[org.apache.spark.Accumulable ]] shared variable of the given type, to which tasks
502+ * can "add" values with `add`. Only the master can access the accumuable's `value`.
503+ *
504+ * This version supports naming the accumulator for display in Spark's web UI.
505+ */
506+ def accumulable [T , R ](initialValue : T , name : String , param : AccumulableParam [T , R ])
507+ : Accumulable [T , R ] =
508+ sc.accumulable(initialValue, name)(param)
509+
451510 /**
452511 * Broadcast a read-only variable to the cluster, returning a
453512 * [[org.apache.spark.broadcast.Broadcast ]] object for reading it in distributed functions.
0 commit comments