ransient 关键字加上和去掉单机执行结果一样,transient 关键字加上有什么作用,什么情况下会有区别?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ransient 关键字加上和去掉单机执行结果一样,transient 关键字加上有什么作用,什么情况下会有区别?

thinktothings
 【问题描述】). transient 关键字加上和去掉单机执行结果一样,transient 关键字加上有什么作用,什么情况下会有区别?).代码public class FraudDetector extends KeyedProcessFunction<Long, Transaction, Alert> {

    private static final long serialVersionUID = 1L;

    private transient ValueState<Boolean> flagState;

    @Override
    public void open(Configuration parameters) {
        ValueStateDescriptor<Boolean> flagDescriptor = new ValueStateDescriptor<>(
                "flag",
                Types.BOOLEAN);
        flagState = getRuntimeContext().getState(flagDescriptor);
    }


【问题复现】).flink 官网示例 : Fraud Detection).代码地址:https://ci.apache.org/projects/flink/flink-docs-release-1.12/try-flink/datastream_api.html