aboutsummaryrefslogtreecommitdiff
path: root/docs/streaming-programming-guide.md
diff options
context:
space:
mode:
authorSean Owen <sowen@cloudera.com>2016-06-12 11:44:33 -0700
committerReynold Xin <rxin@databricks.com>2016-06-12 11:44:33 -0700
commitf51dfe616b24b4234199c98ea857a586a93a889f (patch)
tree2803e1675f1948670ebc3f042789f4b401aa2b3e /docs/streaming-programming-guide.md
parent50248dcfff3ba79b73323f3a804c1e19a8be6097 (diff)
downloadspark-f51dfe616b24b4234199c98ea857a586a93a889f.tar.gz
spark-f51dfe616b24b4234199c98ea857a586a93a889f.tar.bz2
spark-f51dfe616b24b4234199c98ea857a586a93a889f.zip
[SPARK-15086][CORE][STREAMING] Deprecate old Java accumulator API
## What changes were proposed in this pull request? - Deprecate old Java accumulator API; should use Scala now - Update Java tests and examples - Don't bother testing old accumulator API in Java 8 (too) - (fix a misspelling too) ## How was this patch tested? Jenkins tests Author: Sean Owen <sowen@cloudera.com> Closes #13606 from srowen/SPARK-15086.
Diffstat (limited to 'docs/streaming-programming-guide.md')
-rw-r--r--docs/streaming-programming-guide.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/streaming-programming-guide.md b/docs/streaming-programming-guide.md
index 0a6a0397d9..4ea3b60268 100644
--- a/docs/streaming-programming-guide.md
+++ b/docs/streaming-programming-guide.md
@@ -1452,13 +1452,13 @@ class JavaWordBlacklist {
class JavaDroppedWordsCounter {
- private static volatile Accumulator<Integer> instance = null;
+ private static volatile LongAccumulator instance = null;
- public static Accumulator<Integer> getInstance(JavaSparkContext jsc) {
+ public static LongAccumulator getInstance(JavaSparkContext jsc) {
if (instance == null) {
synchronized (JavaDroppedWordsCounter.class) {
if (instance == null) {
- instance = jsc.accumulator(0, "WordsInBlacklistCounter");
+ instance = jsc.sc().longAccumulator("WordsInBlacklistCounter");
}
}
}
@@ -1472,7 +1472,7 @@ wordCounts.foreachRDD(new Function2<JavaPairRDD<String, Integer>, Time, Void>()
// Get or register the blacklist Broadcast
final Broadcast<List<String>> blacklist = JavaWordBlacklist.getInstance(new JavaSparkContext(rdd.context()));
// Get or register the droppedWordsCounter Accumulator
- final Accumulator<Integer> droppedWordsCounter = JavaDroppedWordsCounter.getInstance(new JavaSparkContext(rdd.context()));
+ final LongAccumulator droppedWordsCounter = JavaDroppedWordsCounter.getInstance(new JavaSparkContext(rdd.context()));
// Use blacklist to drop words and use droppedWordsCounter to count them
String counts = rdd.filter(new Function<Tuple2<String, Integer>, Boolean>() {
@Override