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

网站后台限制ip百度应用商店app下载安装

网站后台限制ip,百度应用商店app下载安装,校园网站建设促进教学,做最精彩的绳艺网站1.为啥不使用cep呢,cep的超时时间设置不好配置化,无法满足扩展要求 2.超时怎么界定。A事件发生后,过了N时间,还没有收到B事件,算超时。 代码如下: import com.alibaba.fastjson.JSONObject; import lombo…

1.为啥不使用cep呢,cep的超时时间设置不好配置化,无法满足扩展要求

2.超时怎么界定。A事件发生后,过了N时间,还没有收到B事件,算超时。

代码如下:


import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.flink.api.common.state.ValueState;
import org.apache.flink.api.common.state.ValueStateDescriptor;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.functions.KeyedProcessFunction;
import org.apache.flink.util.Collector;@Slf4j
public class AsyncModelTimeoutHandler extends KeyedProcessFunction<String, JSONObject, JSONObject> {private static final long serialVersionUID = -61608451659272532L;private transient ValueState<Long> firstDataTime;private transient ValueState<Long> secondDataTime;private transient ValueState<String> eventType;@Overridepublic void open(Configuration parameters) throws Exception {ValueStateDescriptor<Long> firstDataDescriptor = new ValueStateDescriptor<>("firstDataTime", Long.class);firstDataTime = getRuntimeContext().getState(firstDataDescriptor);ValueStateDescriptor<Long> secondDataDescriptor = new ValueStateDescriptor<>("secondDataTime", Long.class);secondDataTime = getRuntimeContext().getState(secondDataDescriptor);ValueStateDescriptor<String> eventTypeDescriptor = new ValueStateDescriptor<>("eventType", String.class);eventType = getRuntimeContext().getState(eventTypeDescriptor);}@Overridepublic void processElement(JSONObject value, KeyedProcessFunction<String, JSONObject, JSONObject>.Context ctx, Collector<JSONObject> out) throws Exception {Long currentTimestamp = value.getLong("ts");if (value.containsKey("timeout")) {//异步请求消息long timeout = value.getLong("timeout");firstDataTime.update(currentTimestamp + timeout);eventType.update(value.getString("event"));ctx.timerService().registerProcessingTimeTimer(currentTimestamp + timeout);} else {secondDataTime.update(currentTimestamp);}}@Overridepublic void onTimer(long timestamp, KeyedProcessFunction<String, JSONObject, JSONObject>.OnTimerContext ctx, Collector<JSONObject> out) throws Exception {Long firstTime = firstDataTime.value();Long lastTime = secondDataTime.value();if (lastTime == null || (firstTime != null && lastTime >= firstTime)) {//超时了log.info("AsyncModelTimeoutHandler onTimer handle triggerTime={}, firstTime={}, secondTime={},key={}", timestamp, firstTime, lastTime, ctx.getCurrentKey());JSONObject r = new JSONObject();r.put("id", ctx.getCurrentKey());r.put("judgeTime", timestamp);r.put("event", eventType.value());out.collect(r);}firstDataTime.clear();secondDataTime.clear();eventType.clear();}
}
http://www.zhongyajixie.com/news/25531.html

相关文章:

  • 科技杭州网站建设百度明星人气榜
  • 做旅游网站推广公司全网推广
  • 如果安装wordpress杭州seo推广公司
  • 做网站免费模板怎么上传到空间百家号关键词排名
  • 17网站一起做网店类似的如何网站推广
  • iis上部署手机网站代运营网店公司
  • 心理学网站的建设python培训
  • 农业建设项目管理信息系统网站中国企业培训网
  • 网站布局优化怎么做培训心得简短
  • 广州建设工程交易中心网站bt kitty磁力猫
  • 怎样健网站做什么推广最赚钱
  • 如何写app程序锦州seo推广
  • 网站建设能带来流量么网站提交工具
  • 淮安软件园有做网站的吗重庆网站关键词排名
  • 商业网站开发 说课联合早报 即时消息
  • ·温州公司建设网站seo推广论坛
  • 梧州网站建设设计网络销售是做什么的
  • 用源码做自己的网站什么是长尾关键词举例
  • 南京著名网站制作2023能用的磁力搜索引擎
  • 幼儿园管理网站模板长尾关键词挖掘工具
  • 公司网站建设怎么选择广州白云区今天的消息
  • 做网站可以用微软雅黑字体么高手优化网站
  • 网站建设认证试题中国万网官网登录
  • ai网页生成汕头网站建设方案优化
  • 专做项目报告的网站互联网推广话术
  • 怎么做社交网站百度接单平台
  • 女装网站建设的规划书可以推广发广告的app
  • 网页设计与制作期末作业源代码seo中介平台
  • 只有一个页面的网站怎么做郑州seo外包公司哪家好
  • 网站导航设计模板苏州关键词优化排名推广