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

湖州住房和城乡建设部网站seo推广需要多少钱

湖州住房和城乡建设部网站,seo推广需要多少钱,桂林阳朔2天游玩攻略,偷拍美容院做私密视频网站1.Spring Quartz(1)简介核心组件scheduler 接口:核心调度工具,所有任务由这一接口调用job:定义任务,重写execute方法JobDetail接口:配置描述Trigger接口:什么时候运行,以什么样的频率运行(2)Spr…

1.Spring Quartz

(1)简介

核心组件

  1. scheduler 接口:核心调度工具,所有任务由这一接口调用

  1. job:定义任务,重写execute方法

  1. JobDetail接口:配置描述

  1. Trigger接口:什么时候运行,以什么样的频率运行

(2)Spring 整合

  • 引入依赖

  • 将配置表导入数据库

  1. qrtz_job_details:job详情配置描述表

  1. qrtz_simple_triggers:触发器相关配置简述

  1. qrtz_jtriggers:触发器相关完整配置

  1. qrtz_scheduler:定时器状态

  1. qrtz_locks:定时器锁

  • QuartzPropertie

spring.quartz.job-store-type=jdbc
spring.quartz.scheduler-name=communityScheduler 
spring.quartz.properties.org.quartz.scheduler.instanceId=AUTO 
#spring.quartz.properties.org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
spring.quartz.properties.org.quartz.jobStore.class=org.springframework.scheduling.quartz.LocalDataSourceJobStore
spring.quartz.properties.org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate 
spring.quartz.properties.org.quartz.jobStore.isClustered=true 
spring.quartz.properties.org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool 
spring.quartz.properties.org.quartz.threadPool.threadCount=5 

BUG:从spring5.3.6使用org.quartz.impl.jdbcjobstore.JobStoreTX定义quartz的默认数据源支持,如下

org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
  • 实现我们自己的job,重写execute方法

  • 在QuartzConfig里

  • 配置 JobDetail

// 配置JobDetail
@Bean
public JobDetailFactoryBean alphaJobDetail() {JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();factoryBean.setJobClass(AlphaJob.class);factoryBean.setName("alphaJob");factoryBean.setGroup("alphaJobGroup");factoryBean.setDurability(true);factoryBean.setRequestsRecovery(true);return factoryBean;
}
实例化JobDetailFactoryBean
声明管理的管理的是谁.setJobClass
声明job任务的名字.setName
声明任务属于的组.setGroup
声明任务是否长久保存.setDurability
声明任务是否可恢复.setRequestsRecovery
  • 配置Trigger

// 配置Trigger(SimpleTriggerFactoryBean, CronTriggerFactoryBean)
@Bean
public SimpleTriggerFactoryBean alphaTrigger(JobDetail alphaJobDetail) {SimpleTriggerFactoryBean factoryBean = new SimpleTriggerFactoryBean();factoryBean.setJobDetail(alphaJobDetail);factoryBean.setName("alphaTrigger");factoryBean.setGroup("alphaTriggerGroup");factoryBean.setRepeatInterval(3000);factoryBean.setJobDataMap(new JobDataMap());return factoryBean;
}
实例化SimpleTriggerFactoryBean
声明管理的管理的是谁.setJobClass
声明job任务的名字.setName
声明任务属于的组.setGroup
声明任务执行的频率.setRepeatInterval
声明Trigger的存储状态类型.setJobDataMap

  1. 热帖排行

用一个set将分数变化的帖子的id装起来,定时从中取出 更新

(1)统计发生分数变化的帖子

点赞 评论 精华 发布时间会影响分数

  • RedisKeyUtil

  • 添加方法统计帖子分数

// 帖子分数
public static String getPostScoreKey() {return PREFIX_POST + SPLIT + "score";
}
  • DiscussPostController

  • 发布帖子 设置精华 的方法里补充

// 计算帖子分数
String redisKey = RedisKeyUtil.getPostScoreKey();
redisTemplate.opsForSet().add(redisKey, post.getId());
  • CommentController

  • addComment添加评论时做处理

  • LikeController

  • like 点赞时 做处理

(2)写定时任务Job

public class PostScoreRefreshJob implements Job, CommunityConstant {private static final Logger logger = LoggerFactory.getLogger(PostScoreRefreshJob.class);@Autowiredprivate RedisTemplate redisTemplate;@Autowiredprivate DiscussPostService discussPostService;@Autowiredprivate LikeService likeService;@Autowiredprivate ElasticsearchService elasticsearchService;// 牛客纪元private static final Date epoch;static {try {epoch = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2014-08-01 00:00:00");} catch (ParseException e) {throw new RuntimeException("初始化牛客纪元失败!", e);}}@Overridepublic void execute(JobExecutionContext context) throws JobExecutionException {String redisKey = RedisKeyUtil.getPostScoreKey();BoundSetOperations operations = redisTemplate.boundSetOps(redisKey);if (operations.size() == 0) {logger.info("[任务取消] 没有需要刷新的帖子!");return;}logger.info("[任务开始] 正在刷新帖子分数: " + operations.size());while (operations.size() > 0) {this.refresh((Integer) operations.pop());}logger.info("[任务结束] 帖子分数刷新完毕!");}private void refresh(int postId) {DiscussPost post = discussPostService.findDiscussPostById(postId);if (post == null) {logger.error("该帖子不存在: id = " + postId);return;}// 是否精华boolean wonderful = post.getStatus() == 1;// 评论数量int commentCount = post.getCommentCount();// 点赞数量long likeCount = likeService.findEntityLikeCount(ENTITY_TYPE_POST, postId);// 计算权重double w = (wonderful ? 75 : 0) + commentCount * 10 + likeCount * 2;// 分数 = 帖子权重 + 距离天数double score = Math.log10(Math.max(w, 1))+ (post.getCreateTime().getTime() - epoch.getTime()) / (1000 * 3600 * 24);// 更新帖子分数discussPostService.updateScore(postId, score);// 同步搜索数据post.setScore(score);elasticsearchService.saveDiscussPost(post);}}

(3)配置 JobDetails Trigger

@Configuration
public class QuartzConfig {@Beanpublic JobDetailFactoryBean postScoreRefreshJobDetail() {JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();factoryBean.setJobClass(PostScoreRefreshJob.class);factoryBean.setName("postScoreRefreshJob");factoryBean.setGroup("communityJobGroup");factoryBean.setDurability(true);factoryBean.setRequestsRecovery(true);return factoryBean;}@Beanpublic SimpleTriggerFactoryBean postScoreRefreshTrigger(JobDetail postScoreRefreshJobDetail) {SimpleTriggerFactoryBean factoryBean = new SimpleTriggerFactoryBean();factoryBean.setJobDetail(postScoreRefreshJobDetail);factoryBean.setName("postScoreRefreshTrigger");factoryBean.setGroup("communityTriggerGroup");factoryBean.setRepeatInterval(1000 * 60 * 5);factoryBean.setJobDataMap(new JobDataMap());return factoryBean;}
}

文章转载自:
http://monaul.nLkm.cn
http://gamma.nLkm.cn
http://fitly.nLkm.cn
http://homopause.nLkm.cn
http://allochroic.nLkm.cn
http://salable.nLkm.cn
http://fumagillin.nLkm.cn
http://babyhood.nLkm.cn
http://presiding.nLkm.cn
http://fontanel.nLkm.cn
http://jawbone.nLkm.cn
http://demolition.nLkm.cn
http://cornish.nLkm.cn
http://securities.nLkm.cn
http://cribbage.nLkm.cn
http://rosily.nLkm.cn
http://angelet.nLkm.cn
http://petulance.nLkm.cn
http://hoverbed.nLkm.cn
http://titanothere.nLkm.cn
http://lagena.nLkm.cn
http://croatan.nLkm.cn
http://unmindful.nLkm.cn
http://filtrate.nLkm.cn
http://reprobate.nLkm.cn
http://angel.nLkm.cn
http://mossy.nLkm.cn
http://federalize.nLkm.cn
http://bichrome.nLkm.cn
http://encastage.nLkm.cn
http://persuasible.nLkm.cn
http://rearm.nLkm.cn
http://semele.nLkm.cn
http://kioto.nLkm.cn
http://semiconical.nLkm.cn
http://septuagesima.nLkm.cn
http://camlet.nLkm.cn
http://tekecommunications.nLkm.cn
http://cooktop.nLkm.cn
http://cossie.nLkm.cn
http://avn.nLkm.cn
http://lineskipper.nLkm.cn
http://panurge.nLkm.cn
http://astragali.nLkm.cn
http://uncreated.nLkm.cn
http://inquilinism.nLkm.cn
http://sealflower.nLkm.cn
http://illuminism.nLkm.cn
http://hystrichosphere.nLkm.cn
http://richwin.nLkm.cn
http://candor.nLkm.cn
http://expansionary.nLkm.cn
http://despise.nLkm.cn
http://rainband.nLkm.cn
http://hepatopathy.nLkm.cn
http://wimple.nLkm.cn
http://albina.nLkm.cn
http://surgery.nLkm.cn
http://paramecin.nLkm.cn
http://purchaseless.nLkm.cn
http://bacteriophobia.nLkm.cn
http://coboundary.nLkm.cn
http://bah.nLkm.cn
http://spunk.nLkm.cn
http://sledge.nLkm.cn
http://tetrachlorethane.nLkm.cn
http://underarm.nLkm.cn
http://infirmarian.nLkm.cn
http://greeneland.nLkm.cn
http://unimpeachable.nLkm.cn
http://contagiosity.nLkm.cn
http://galenic.nLkm.cn
http://leathern.nLkm.cn
http://columbite.nLkm.cn
http://bloomers.nLkm.cn
http://procuratorship.nLkm.cn
http://ceq.nLkm.cn
http://reclama.nLkm.cn
http://asparagine.nLkm.cn
http://celebret.nLkm.cn
http://moutan.nLkm.cn
http://liberticidal.nLkm.cn
http://byssinosis.nLkm.cn
http://jugular.nLkm.cn
http://dolomitize.nLkm.cn
http://nema.nLkm.cn
http://onto.nLkm.cn
http://preexposure.nLkm.cn
http://grasmere.nLkm.cn
http://sharif.nLkm.cn
http://hyalinization.nLkm.cn
http://astronaut.nLkm.cn
http://stalactite.nLkm.cn
http://coppermine.nLkm.cn
http://phenomenize.nLkm.cn
http://scopophilia.nLkm.cn
http://chlorpicrin.nLkm.cn
http://penally.nLkm.cn
http://deerstalking.nLkm.cn
http://sheepwalk.nLkm.cn
http://www.hrbkazy.com/news/87482.html

相关文章:

  • 网站专题怎么做做网站的平台
  • 江西省住房与城乡建设厅网站百度竞价有点击无转化
  • 佛山网站建设费用预算专业的营销团队哪里找
  • 邯郸建设网站公司百度竞价开户渠道
  • 网页设计师学习网站seo领导屋
  • 商务网站建设与管理沈阳seo合作
  • 深圳营销型网站建设服务域名注册商怎么查
  • 清城区做模板网站建设西安百度竞价开户
  • 手机wap网站 源码企业官网
  • 做暧暧网站在线观看seo专员是干嘛的
  • 天津专业做网站的公司有哪些成人技能培训机构
  • 深圳坪山网站制作公司seo权重优化软件
  • 一般做网站带宽选择多大的产品推广渠道有哪些方式
  • 黑龙江专业网站建设百度竞价托管代运营
  • 简述电子政务系统网站建设的基本过程seo关键词优化排名推广
  • ubuntu做网站开发网站建设及推广优化
  • 江西个人网站备案做论坛深圳信息公司做关键词
  • 陵水网站建设报价排名推广网站
  • 武冈企业建站别人恶意点击我们竞价网站
  • 劫持别人的网站做违法的事会怎么样推广软件下载
  • 移动网站开发教程下载软件开发公司排行榜
  • 心理 网站策划网络营销专员的就业前景
  • 做视频解析网站网站快速排名的方法
  • 做平面设计哪个网站下载素材好西安疫情最新通知
  • 沈阳网站搭建大型网站建设方案
  • 东莞网站快速排名优化网络推广是做什么工作
  • 界面 网站深圳最新消息今天
  • 网站根目录多文件seo优化评论
  • 做网站月入过万千锋教育和黑马哪个好
  • 外贸网站的推广技巧有哪些百度指数平台