@@ -83,9 +83,9 @@ public Optional<Integer> call(List<Integer> values, Optional<Integer> state) {
8383 ssc .checkpoint ("." );
8484
8585 // Initial RDD input to updateStateByKey
86- JavaPairRDD < String , Integer > initialRDD = ssc . sc ()
87- . parallelizePairs ( Arrays . asList ( new Tuple2 <String , Integer >("hello " , 1 ), new Tuple2 < String , Integer >
88- ( "world" , 1 )) );
86+ List < Tuple2 < String , Integer >> tuples = Arrays . asList ( new Tuple2 < String , Integer >( "hello" , 1 ),
87+ new Tuple2 <String , Integer >("world " , 1 ));
88+ JavaPairRDD < String , Integer > initialRDD = ssc . sc (). parallelizePairs ( tuples );
8989
9090 JavaReceiverInputDStream <String > lines = ssc .socketTextStream (
9191 args [0 ], Integer .parseInt (args [1 ]), StorageLevels .MEMORY_AND_DISK_SER_2 );
@@ -105,8 +105,8 @@ public Tuple2<String, Integer> call(String s) {
105105 });
106106
107107 // This will give a Dstream made of state (which is the cumulative count of the words)
108- JavaPairDStream <String , Integer > stateDstream = wordsDstream .updateStateByKey (updateFunction , new
109- HashPartitioner (ssc .sc ().defaultParallelism ()), initialRDD );
108+ JavaPairDStream <String , Integer > stateDstream = wordsDstream .updateStateByKey (updateFunction ,
109+ new HashPartitioner (ssc .sc ().defaultParallelism ()), initialRDD );
110110
111111 stateDstream .print ();
112112 ssc .start ();
0 commit comments