被coflatmap函数卡住了。如果我把它放在window之前的数据流中,它似乎可以正常 job ,但是如果放在window的“apply”函数之后,它就会失败。
我正在 test两个流,flatMap1上的主要“特性”不断地摄取数据,flatMap2上的控制流“模型” root据请求更改模型。
我可以在flatMap2中正确设置b0/b1,但是flatMap1总是看到b0和b1在初始化时被设置为0。
我是不是漏掉了什么明显的东西?
public static class applyModel implements CoFlatMapFunction<Features, Model, EnrichedFeatures> {
private static final long serialVersionUID = 1L;
Double b0;
Double b1;
public applyModel(){
b0=0.0;
b1=0.0;
}
@Override
public void flatMap1(Features value, Collector<EnrichedFeatures> out) {
System.out.print("Main: " + this + "
");
}
@Override
public void flatMap2(Model value, Collector<EnrichedFeatures> out) {
System.out.print("Old Model: " + this + "
");
b0 = value.getB0();
b1 = value.getB1();
System.out.print("New Model: " + this + "
");
}
@Override
public String toString(){
return "CoFlatMapFunction: {b0: " + b0 + ", b1: " + b1 + "}";
}
}