Spark mapToPair() 함수에서 DefaultMutableTreeNode 변수의 값을 사용하면 기본값이 기본값으로 바뀝니다. 여기 내 코드는 다음과 같습니다DefaultMutableTreeNode 값을 Spark mapToPair에 사용할 때 기본값으로 설정합니다.
public class CA implements Serializable{
private final JavaRDD<String> input;
private final List<IB> bList;
public boolean FuncWithSpark(){
/*
!!!at this point, bList.get(0).getD().getRoot() return a valid tree node
*/
JavaRDD<Boolean> counters = input.mapToPair(new PairFunction<String, String, List<String>>() {
@Override
public Tuple2<String, List<String>> call(String s) throws Exception {
/*
!!!at this point, bList.get(0).getD().getRoot() return an uninitialized tree node with default values
*/
...
}
}
}
public CA(JavaRDD<String> input, List<IB> bList) {
this.input = input;
this.bList = bList;
}
}
인터페이스 IB, ID, 클래스 CB와 CD는 다음과 같이 정의된다 :
public interface IB {
...
}
public interface ID {
...
}
public class CB implements IB, Serializable{
private final ID d;
public ID getD(){
return this.d;
}
}
public class CD implements ID, Serializable{
private DefaultMutableTreeNode rootNode;
public DefaultMutableTreeNode getRoot(){
return this.rootNode;
}
}
질문) (CA.FuncWithSpark에서 형의 DefaultMutableTreeNode의 변수에 무슨 일이 있었는지, 무엇입니까? 그것은 Spark 변환 때문입니까, 아니면 DefaultMutableTreeNode의 멤버 변수가 보호되어 있고 그것들에 접근자가 없습니까? 이 문제를 해결할 방향을 알려주십시오. 사전에 도움을 주셔서 감사합니다!.