Access Spark broadcast variable in different classes
问题 I am broadcasting a value in Spark Streaming application . But I am not sure how to access that variable in a different class than the class where it was broadcasted. My code looks as follows: object AppMain{ def main(args: Array[String]){ //... val broadcastA = sc.broadcast(a) //.. lines.foreachRDD(rdd => { val obj = AppObject1 rdd.filter(p => obj.apply(p)) rdd.count } } object AppObject1: Boolean{ def apply(str: String){ AnotherObject.process(str) } } object AnotherObject{ // I want to use