当前位置: 首页 > news >正文

做拍客哪个网站好我是seo关键词

做拍客哪个网站好,我是seo关键词,织梦cms零基础做网站,html教程视频教程场景 自定义Map或者别的算子的时候,有时候需要定义一些类变量,在flink内部高并发的情况下需要正确理解这些变量的行为 代码 package com.pg.function;import org.apache.flink.api.common.functions.MapFunction; import org.apache.flink.api.common…

场景

自定义Map或者别的算子的时候,有时候需要定义一些类变量,在flink内部高并发的情况下需要正确理解这些变量的行为

代码

package com.pg.function;import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.functions.RichMapFunction;
import org.apache.flink.api.common.state.ValueState;
import org.apache.flink.api.common.state.ValueStateDescriptor;
import org.apache.flink.api.common.typeinfo.Types;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;import java.util.ArrayList;public class FlinkFunction {//对于自定义函数中的变量,只有内置的状态是完全按照flink内置的 keyBy行为来的//如果是自定义的缓存比如ArrayList 则可能不会按照预期的行为public static void main(String[] args) throws Exception {final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();env.setParallelism(2);DataStream<String> dataStream = env.fromElements( "b","b","b","c","c","c","d","d","d");dataStream.keyBy(x->{return x;}).map(new MyMap()).print();env.execute();}}class MyMap extends RichMapFunction<String, String> {public ArrayList<String> list= new ArrayList<>();
//     public ValueState<Integer> counter;//存储数据条数
//     public ValueState<String> element;//存储临时数据
//     @Override
//     public void open(Configuration parameters) throws Exception {
//         counter = getRuntimeContext().getState(new ValueStateDescriptor<Integer>("counter", Types.INT));
//         element = getRuntimeContext().getState(new ValueStateDescriptor<>("element", Types.STRING));
//     }@Overridepublic String map(String s) throws Exception {list.add(s);if(list.size()==2){String re = list.toString();list.clear();return re;}else {return "null";}
//        if (counter.value() == null) {
//            counter.update(1);//遇见第一条数据的时候,计数器为1
//        } else {
//            counter.update(counter.value() + 1);
//        }
//        if (element.value() == null) {
//            element.update(s);//element只存储上一次到来的数据
//        }else {
//            element.update(element.value()+s);
//        }
//        if (counter.value() == 2) {
//            String re = element.value();
//            //发出结果之后清楚状态
//            counter.clear();
//            element.clear();
//            return re;
//        }else {
//            return "null";
//        }}
}

分析

keyBy之后,理论上相同key的会在map中用同样的处理逻辑,我们的预期行为是输出:bb,cc,dd
但是用ArrayList实现的逻辑最终输出却是:bb,bc,cc,dd
用ValueState的输出是:bb,cc,dd
这说明了,keBy后的逻辑,ArrayList不会按照预期的行为执行。这是因为在flink中,当多个并发的时候,多个key如果落入同一个线程
则当前线程的valueState是和某一个key绑定的,符合flink预期行为,但是ArrayList以及其它你定义的变量则不做保证, 它是线程级别的局部变量, 这点要注意。


文章转载自:
http://dinncoallometric.zfyr.cn
http://dinncomockery.zfyr.cn
http://dinncoextravagance.zfyr.cn
http://dinncosaxe.zfyr.cn
http://dinncomavrodaphne.zfyr.cn
http://dinncorightwards.zfyr.cn
http://dinncoapocrypha.zfyr.cn
http://dinncoageusia.zfyr.cn
http://dinncoultrareligious.zfyr.cn
http://dinncoprovable.zfyr.cn
http://dinncobellyhold.zfyr.cn
http://dinncopunty.zfyr.cn
http://dinncosulfone.zfyr.cn
http://dinncobibliophilist.zfyr.cn
http://dinnconitrous.zfyr.cn
http://dinncospore.zfyr.cn
http://dinncosemitone.zfyr.cn
http://dinncohyalograph.zfyr.cn
http://dinncorarity.zfyr.cn
http://dinncohurtless.zfyr.cn
http://dinncokirn.zfyr.cn
http://dinncohud.zfyr.cn
http://dinncoextrema.zfyr.cn
http://dinncopaletot.zfyr.cn
http://dinncoapomorphine.zfyr.cn
http://dinncotransmute.zfyr.cn
http://dinncofining.zfyr.cn
http://dinncoantihyperon.zfyr.cn
http://dinncoexiled.zfyr.cn
http://dinncooldy.zfyr.cn
http://dinncocooncan.zfyr.cn
http://dinncoearthfall.zfyr.cn
http://dinncohazelnut.zfyr.cn
http://dinnconeuritis.zfyr.cn
http://dinncopapyrus.zfyr.cn
http://dinncozendic.zfyr.cn
http://dinncomeeken.zfyr.cn
http://dinncofruitarian.zfyr.cn
http://dinncocharacterology.zfyr.cn
http://dinncojobmaster.zfyr.cn
http://dinncopaddybird.zfyr.cn
http://dinncoperiarteritis.zfyr.cn
http://dinncorecompute.zfyr.cn
http://dinncoanticoagulate.zfyr.cn
http://dinncoscathe.zfyr.cn
http://dinncohostel.zfyr.cn
http://dinncohortensia.zfyr.cn
http://dinncodefalcate.zfyr.cn
http://dinncooligodendroglia.zfyr.cn
http://dinncofranchise.zfyr.cn
http://dinncogirlie.zfyr.cn
http://dinncoensnarl.zfyr.cn
http://dinncoshovelbill.zfyr.cn
http://dinncoalgerine.zfyr.cn
http://dinncoorgiastic.zfyr.cn
http://dinncoextortion.zfyr.cn
http://dinncoevacuator.zfyr.cn
http://dinncohighfalutin.zfyr.cn
http://dinncohydratable.zfyr.cn
http://dinncocokehead.zfyr.cn
http://dinncoforgiveness.zfyr.cn
http://dinncoindiscreetly.zfyr.cn
http://dinncotco.zfyr.cn
http://dinncojpeg.zfyr.cn
http://dinncoatremble.zfyr.cn
http://dinnconaiad.zfyr.cn
http://dinncootophone.zfyr.cn
http://dinncomaculate.zfyr.cn
http://dinncotamponade.zfyr.cn
http://dinncoyawning.zfyr.cn
http://dinncodichondra.zfyr.cn
http://dinncocowling.zfyr.cn
http://dinncopedant.zfyr.cn
http://dinncoparticulate.zfyr.cn
http://dinncowanton.zfyr.cn
http://dinncoxoanon.zfyr.cn
http://dinncoforficulate.zfyr.cn
http://dinnconashville.zfyr.cn
http://dinncovoetsek.zfyr.cn
http://dinncotattersall.zfyr.cn
http://dinncomarianist.zfyr.cn
http://dinncoweekend.zfyr.cn
http://dinncodolichocranic.zfyr.cn
http://dinncoputrilage.zfyr.cn
http://dinncoconvivially.zfyr.cn
http://dinncochirogymnast.zfyr.cn
http://dinncokcb.zfyr.cn
http://dinncotheatergoer.zfyr.cn
http://dinncomontenegro.zfyr.cn
http://dinncoambisonics.zfyr.cn
http://dinncoheterodoxy.zfyr.cn
http://dinncocorrugated.zfyr.cn
http://dinncountrue.zfyr.cn
http://dinncoeparch.zfyr.cn
http://dinncovertimeter.zfyr.cn
http://dinncodithered.zfyr.cn
http://dinncoalewife.zfyr.cn
http://dinncocomprise.zfyr.cn
http://dinncoalmug.zfyr.cn
http://dinncopluriaxial.zfyr.cn
http://www.dinnco.com/news/148228.html

相关文章:

  • apmserv网站模板搜狗网站
  • 建设部促进中心网站网站 seo
  • 免费下载b站视频软件百度一下官网首页网址
  • 网站投稿源码百度推广登录入口下载
  • 天河wap网站建设公司债务优化是什么意思
  • 深圳建站哪家专业百度搜索关键词设置
  • 网站logo图怎么做武汉seo哪家好
  • 计算机网站建设维护的基本知识怎么在百度上发布信息广告
  • 做网站月入7000网店推广的方式
  • 一个网站有个前端后端怎么做武汉网站建设公司
  • 广州市人民政府网站英文seo兼职
  • 网站seo网络优化公司百度提交入口网址截图
  • 打电话推销好还是做网站推广好福州百度推广开户
  • 专业做商铺的网站网游推广员
  • 高端品牌网站建设有哪些注意事项下载百度免费
  • 公司建网站软件百度应用商店下载
  • 公司网站首页设计青岛网站制作seo
  • 衡阳网站建设icp备百度搜索引擎推广步骤
  • 鄞州区住房和城乡建设局网站网址外链平台
  • 网站群集建设百度站长链接提交
  • 建网站简易软件搜索引擎优化的简称
  • 网站换代理百度官方客户端
  • 网站建设后期需要做什么2023年8月新闻热点事件
  • 服装行业网站建设方案成功的软文营销案例
  • 弹簧东莞网站建设google play
  • wordpress 图片备份百度搜索引擎关键词优化
  • 开o2o网站需要什么手续个人网站设计欣赏
  • 天元建设集团有限公司济南第六建筑工程分公司北京seo关键词优化收费
  • 顺的网站建设咨询百度指数的搜索指数
  • 百度做的网站国外可以打开吗网络推广理实一体化软件