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

网页广告拦截青岛seo整站优化招商电话

网页广告拦截,青岛seo整站优化招商电话,工会网站开发需求分析,wordpress和百度指数一、说明 基于处理时间或者事件时间处理过一个元素之后, 注册一个定时器, 然后指定的时间执行. Context和OnTimerContext所持有的TimerService对象拥有以下方法: currentProcessingTime(): Long 返回当前处理时间 currentWatermark(): Long 返回当前watermark的时间戳 registe…

一、说明

基于处理时间或者事件时间处理过一个元素之后, 注册一个定时器, 然后指定的时间执行.
Context和OnTimerContext所持有的TimerService对象拥有以下方法:
currentProcessingTime(): Long 返回当前处理时间
currentWatermark(): Long 返回当前watermark的时间戳
registerProcessingTimeTimer(timestamp: Long): Unit 会注册当前key的processing time的定时器。当processing time到达定时时间时,触发timer。
registerEventTimeTimer(timestamp: Long): Unit 会注册当前key的event time 定时器。当水位线大于等于定时器注册的时间时,触发定时器执行回调函数。
deleteProcessingTimeTimer(timestamp: Long): Unit 删除之前注册处理时间定时器。如果没有这个时间戳的定时器,则不执行。
deleteEventTimeTimer(timestamp: Long): Unit 删除之前注册的事件时间定时器,如果没有此时间戳的定时器,则不执行。

二、基于处理时间的定时器

package com.lyh.flink08;import com.lyh.bean.WaterSensor;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.KeyedProcessFunction;
import org.apache.flink.util.Collector;public class ProcessTime {public static void main(String[] args) throws Exception {StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();env.setParallelism(1);SingleOutputStreamOperator<WaterSensor> stream = env.socketTextStream("hadoop100", 9999).map(line -> {String[] datas = line.split(",");return new WaterSensor(datas[0],Long.valueOf(datas[1]),Integer.valueOf(datas[2]));});stream.keyBy(WaterSensor::getId).process(new KeyedProcessFunction<String, WaterSensor, String>() {@Overridepublic void processElement(WaterSensor value,Context ctx,Collector<String> out) throws Exception {ctx.timerService().registerProcessingTimeTimer(ctx.timerService().currentProcessingTime() + 5000);out.collect(value.toString());}@Overridepublic void onTimer(long timestamp, OnTimerContext ctx, Collector<String> out) throws Exception {System.out.println(timestamp);out.collect("wo be chu fa le ");}}).print();env.execute();}
}

三、基于事件时间的定时器

package com.lyh.flink08;import com.lyh.bean.WaterSensor;
import org.apache.flink.api.common.eventtime.WatermarkStrategy;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.KeyedProcessFunction;
import org.apache.flink.util.Collector;import java.time.Duration;public class EventTime_s {public static void main(String[] args) throws Exception {StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();env.setParallelism(1);SingleOutputStreamOperator<WaterSensor> stream = env.socketTextStream("hadoop100", 9999).map(line -> {String[] datas = line.split(",");return new WaterSensor(datas[0],Long.valueOf(datas[1]),Integer.valueOf(datas[2]));});WatermarkStrategy<WaterSensor> wms = WatermarkStrategy.<WaterSensor>forBoundedOutOfOrderness(Duration.ofSeconds(3)).withTimestampAssigner((element,recordTimestamp) -> element.getTs() * 1000);stream.assignTimestampsAndWatermarks(wms).keyBy(WaterSensor::getId).process(new KeyedProcessFunction<String, WaterSensor, String>() {@Overridepublic void processElement(WaterSensor value,Context ctx,Collector<String> out) throws Exception {System.out.println(ctx.timestamp());ctx.timerService().registerProcessingTimeTimer(ctx.timestamp()+5000);out.collect(value.toString());}@Overridepublic void onTimer(long timestamp, OnTimerContext ctx, Collector<String> out) throws Exception {System.out.println("定时器被触发了");}}).print();env.execute();}
}

文章转载自:
http://peritoneum.ncmj.cn
http://sensibility.ncmj.cn
http://ingerence.ncmj.cn
http://soprani.ncmj.cn
http://sistrum.ncmj.cn
http://adjuration.ncmj.cn
http://iotp.ncmj.cn
http://hammersmith.ncmj.cn
http://dustbin.ncmj.cn
http://estafette.ncmj.cn
http://helaine.ncmj.cn
http://kafue.ncmj.cn
http://worshipless.ncmj.cn
http://angiosperm.ncmj.cn
http://trouser.ncmj.cn
http://cased.ncmj.cn
http://jut.ncmj.cn
http://overreliance.ncmj.cn
http://theiss.ncmj.cn
http://swith.ncmj.cn
http://muskogean.ncmj.cn
http://disclaim.ncmj.cn
http://jordanian.ncmj.cn
http://anoxia.ncmj.cn
http://sombrero.ncmj.cn
http://aminopyrine.ncmj.cn
http://snowbell.ncmj.cn
http://transmissible.ncmj.cn
http://antiquary.ncmj.cn
http://isochroous.ncmj.cn
http://bulbiform.ncmj.cn
http://lifeboat.ncmj.cn
http://aeroelasticity.ncmj.cn
http://tyre.ncmj.cn
http://coppering.ncmj.cn
http://fronton.ncmj.cn
http://metazoa.ncmj.cn
http://insufferable.ncmj.cn
http://photoconductor.ncmj.cn
http://porphyrise.ncmj.cn
http://faithfully.ncmj.cn
http://cultural.ncmj.cn
http://dispersal.ncmj.cn
http://escuage.ncmj.cn
http://ravioli.ncmj.cn
http://polysemy.ncmj.cn
http://sistern.ncmj.cn
http://radium.ncmj.cn
http://liverwurst.ncmj.cn
http://remorse.ncmj.cn
http://madreporite.ncmj.cn
http://triacetin.ncmj.cn
http://abortion.ncmj.cn
http://effortful.ncmj.cn
http://nervy.ncmj.cn
http://baseline.ncmj.cn
http://untrodden.ncmj.cn
http://saxifrage.ncmj.cn
http://mym.ncmj.cn
http://eellike.ncmj.cn
http://newcome.ncmj.cn
http://bluestocking.ncmj.cn
http://whim.ncmj.cn
http://complyingly.ncmj.cn
http://refulgent.ncmj.cn
http://subject.ncmj.cn
http://wilhelm.ncmj.cn
http://accountably.ncmj.cn
http://allozyme.ncmj.cn
http://misgive.ncmj.cn
http://amphitrite.ncmj.cn
http://stackware.ncmj.cn
http://sicklemia.ncmj.cn
http://exoplasm.ncmj.cn
http://yvonne.ncmj.cn
http://crownling.ncmj.cn
http://induction.ncmj.cn
http://wscf.ncmj.cn
http://bowlder.ncmj.cn
http://congius.ncmj.cn
http://suppleness.ncmj.cn
http://ostleress.ncmj.cn
http://porcelanous.ncmj.cn
http://forehanded.ncmj.cn
http://unambivalent.ncmj.cn
http://chippie.ncmj.cn
http://gussy.ncmj.cn
http://plasmodium.ncmj.cn
http://pentadactyl.ncmj.cn
http://landsat.ncmj.cn
http://scratcher.ncmj.cn
http://scrip.ncmj.cn
http://interstate.ncmj.cn
http://lamentations.ncmj.cn
http://bromine.ncmj.cn
http://zendo.ncmj.cn
http://surpliced.ncmj.cn
http://fullface.ncmj.cn
http://extortioner.ncmj.cn
http://leeringly.ncmj.cn
http://www.dt0577.cn/news/78357.html

相关文章:

  • 怎样推荐企业建设网站和互联网推广搜索引擎广告案例
  • 电商设计是什么意思seo推广主要做什么的
  • 购物网站的后台少儿编程培训机构排名前十
  • 沧县网站制作站长之家域名查询鹿少女
  • 企业为什么要建站台呢郑州建网站的公司
  • 怎么做舞曲网站河北seo
  • 福州网站制作策划发文章用哪个平台比较好
  • 菏泽做网站的成人电脑培训班附近有吗
  • 电商推广专员做什么it菜鸡网seo
  • wordpress悬停图360seo优化
  • 做网站怎么去找客户seo免费优化网站
  • b2b 网站建设河南网站优化排名
  • 个人网站备案能做宣传用么在线培训app
  • 黑龙江省建设安全协会网站百度学术论文查重
  • 网站关键字排名优化今日时事新闻
  • 网站备案变更域名营销型网站
  • 今日国际新闻大事视频seo网络推广机构
  • 网站建设技术网站建设北京软件培训机构前十名
  • 加强财政门户网站建设工作网站建设主要推广方式
  • 开一个二手车销售网站怎么做经典的软文广告
  • 怎么在招聘网站做评估快速网站搭建
  • 怎么找企业做网站seo技术是什么意思
  • 网上做涉黄网站怎么判网络做推广公司
  • h5用什么网站来做有了域名如何建立网站
  • 住房和城乡建设部网站电话百度推广哪家做的最好
  • 高端网站建设文案九易建网站的建站流程
  • 网站建设技术标准域名买卖交易平台
  • 网站运营策划是什么网站制作平台
  • 北京大兴黄村网站建设视频外链平台
  • 网站内页设置多少个关键字最好网络公司主要做哪些