Related to this question, I got the tip that the getOrCreate
idiom should be used to avoid this issues. But trying:
JavaStreamingContextFactory cont
According to this question I think this is how I should do it:
SparkConf conf = new SparkConf().setAppName(NAME);
JavaSparkContext ctx = JavaSparkContext.fromSparkContext(SparkContext.getOrCreate(conf));
JavaStreamingContext context = new JavaStreamingContext(ctx, Durations.seconds(BATCH_SPAN));
Right?