定时器任务
//applicationContext.xml com.lenovo.lps.psb.pb.ResetPushCntCacheJob 0 55 23 * * ? com.lenovo.lps.psb.pushmarketing.IpToperationAreaJob 0 10 0 * * ? com.lenovo.lps.psb.pushmarketing.FlushDeviceDimenJob 0 40 0 * * ? com.lenovo.lps.psb.pushmarketing.ExecutePushTaskJob 0 0 1 * * ?
import java.util.Iterator; import java.util.Map;import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.springframework.scheduling.quartz.QuartzJobBean;import com.lenovo.lps.log.Log; import com.lenovo.lps.psb.common.log.reduce.dao.MysqlSpiderDSFacadeImpl; import com.lenovo.lps.psb.common.util.IocUtils; import com.lenovo.lps.psb.pb.cache.PushCntCache; import com.lenovo.lps.psb.pb.cache.PushCntVO;/** * */ public class ResetPushCntCacheJob extends QuartzJobBean { //private PushCntCache pushCntCache; private static Log log = Log.getInstance(ResetPushCntCacheJob.class); @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { System.out.println("ResetPushCntCacheJob=======================executeInternal-------------"); log.info("ResetPushCntCacheJob=======================executeInternal-------------"); PushCntCache pushCntCache= (PushCntCache) IocUtils.getBean("pushCntCache"); try { if(pushCntCache!=null){ PushCntVO vo=pushCntCache.getPushCnt(); if(vo!=null&&(vo.getSidarrivedcntMap()!=null||vo.getSidreceivedcntMap()!=null)){ vo=new PushCntVO(); pushCntCache.savePushCnt(vo); } } //将Push处理总量、到达量分布日报情况数据写入数据库 MysqlSpiderDSFacadeImpl mysqlSpiderDSFacadeImpl = (MysqlSpiderDSFacadeImpl) IocUtils.getBean(MysqlSpiderDSFacadeImpl.BEAN_NAME); savePushmsgsIndicatorToDB(1,pushCntCache,mysqlSpiderDSFacadeImpl); } catch (Exception e) { log.warn(e); } } public void savePushmsgsIndicatorToDB(int reportType,PushCntCache pushCntCache,MysqlSpiderDSFacadeImpl mysqlSpiderDSFacadeImpl){ //处理量统计 long tianqi_cnt_temp=0; long neirong_cnt_temp=0; long qiyeyoujian_cnt_temp=0; long gexinghuapush_cnt_temp=0; long leshangdian_cnt_temp=0; long gerenyoujian_cnt_temp=0; long qita_cnt_temp=0; long rsys001_cnt_temp=0; long pushtome_cnt_temp=0; //到达量统计 long tianqi_arr_cnt_temp=0; long neirong_arr_cnt_temp=0; long qiyeyoujian_arr_cnt_temp=0; long gexinghuapush_arr_cnt_temp=0; long leshangdian_arr_cnt_temp=0; long gerenyoujian_arr_cnt_temp=0; long qita_arr_cnt_temp=0; long rsys001_arr_cnt_temp=0; long pushtome_arr_cnt_temp=0; if(pushCntCache==null||pushCntCache.getPushCnt()==null){ return ; } System.out.println("ResetPushCntCacheJob::---pushCntCache.getPushCnt():"+pushCntCache.getPushCnt()); Map sidarrivedcntMap =pushCntCache.getPushCnt().getSidarrivedcntMap(); Map sidreceivedcntMap =pushCntCache.getPushCnt().getSidreceivedcntMap(); //处理接受服务消息量统计记录 if(sidreceivedcntMap!=null&&sidreceivedcntMap.entrySet().size()>0){ Iterator it = sidreceivedcntMap.entrySet().iterator(); while(it.hasNext()){ Map.Entry m=(Map.Entry)it.next(); System.out.println("++++++++++++++++++sidreceivedcntMap+++++++++++++++++++++" + m.getKey() + ":" + m.getValue()); long cntvalue=m.getValue(); if("rwthr01".equals(m.getKey())){ tianqi_cnt_temp=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(receive_key_prefix+m.getKey(), cntvalue+""); //System.out.println("rwthr01::" +tianqi_cnt_temp); }else if("rlpm001".equals(m.getKey() )){ gerenyoujian_cnt_temp=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(receive_key_prefix+m.getKey(), cntvalue+""); //System.out.println("rlpm001::" +gerenyoujian_cnt_temp); }else if("rlesesc".equals(m.getKey() )){ qiyeyoujian_cnt_temp=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(receive_key_prefix+m.getKey(), cntvalue+""); //System.out.println("rlesesc::" +qiyeyoujian_cnt_temp); }else if("rcntrss".equals(m.getKey() )){ gexinghuapush_cnt_temp=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(receive_key_prefix+m.getKey(), cntvalue+""); //System.out.println("rcntrss::" +gexinghuapush_cnt_temp); }else if("rapp001".equals(m.getKey() )){ leshangdian_cnt_temp=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(receive_key_prefix+m.getKey(), cntvalue+""); //System.out.println("rapp001::" +leshangdian_cnt_temp); }else if("rcntv01".equals(m.getKey() )){ neirong_cnt_temp+=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(receive_key_prefix+m.getKey(), cntvalue+""); //System.out.println("rcntv01::" +cntvalue); }else if("rcntn02".equals(m.getKey() )){ neirong_cnt_temp+=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(receive_key_prefix+m.getKey(), cntvalue+""); //System.out.println("rcntn02::" +cntvalue); }else if("rsys001".equals(m.getKey() )){ rsys001_cnt_temp+=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(receive_key_prefix+m.getKey(), cntvalue+""); //System.out.println("rsys001::" +cntvalue); }else if("rsys100".equals(m.getKey() )){ rsys001_cnt_temp+=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(receive_key_prefix+m.getKey(), cntvalue+""); //System.out.println("rsys001::" +cntvalue); }else if("1008".equals(m.getKey() )){ //pushtome_cnt_temp=cntvalue; qita_cnt_temp=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(receive_key_prefix+m.getKey(), cntvalue+""); //System.out.println("rsys001::" +cntvalue); }else{ //其他应用大于10W推送总量时,记录到文件中. //if(cntvalue>100000){ //SidPushmsgCntFile.saveSidPushmsgCntValue(receive_key_prefix+m.getKey(), cntvalue+""); //System.out.println(m.getKey()+"::" +cntvalue); //} qita_cnt_temp+=cntvalue; } } } //处理量统计 // long tianqi_cnt_temp=0; // long neirong_cnt_temp=0; // long qiyeyoujian_cnt_temp=0; // long gexinghuapush_cnt_temp=0; // long leshangdian_cnt_temp=0; // long gerenyoujian_cnt_temp=0; // long qita_cnt_temp=0; // long rsys001_cnt_temp=0; // long pushtome_cnt_temp=0; String[] recepushindicators=new String[15]; recepushindicators[0]="0"; recepushindicators[1]="0"; recepushindicators[2]="0"; recepushindicators[3]="0"; recepushindicators[4]="0"; recepushindicators[5]="0"; recepushindicators[6]=tianqi_cnt_temp+""; recepushindicators[7]=neirong_cnt_temp+""; recepushindicators[8]=qiyeyoujian_cnt_temp+""; recepushindicators[9]=gexinghuapush_cnt_temp+""; recepushindicators[10]=leshangdian_cnt_temp+""; recepushindicators[11]=gerenyoujian_cnt_temp+""; recepushindicators[12]=rsys001_cnt_temp+""; recepushindicators[13]=qita_cnt_temp+""; recepushindicators[14]="0"; //sid接受消息分布统计 mysqlSpiderDSFacadeImpl.savePushIncatorToDB(10,recepushindicators); //处理到达服务消息量统计记录 if(sidarrivedcntMap!=null&&sidarrivedcntMap.entrySet().size()>0){ Iterator arrivedit = sidarrivedcntMap.entrySet().iterator(); while(arrivedit.hasNext()){ Map.Entry m=(Map.Entry)arrivedit.next(); System.out.println("++++++++++++++++++sidarrivedcntMap++++++++++++++++++" + m.getKey() + ":" + m.getValue()); long cntvalue=m.getValue(); if("rwthr01".equals(m.getKey())){ tianqi_arr_cnt_temp=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(arrived_key_prefix+m.getKey(), cntvalue+""); }else if("rlpm001".equals(m.getKey() )){ gerenyoujian_arr_cnt_temp=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(arrived_key_prefix+m.getKey(), cntvalue+""); }else if("rlesesc".equals(m.getKey() )){ qiyeyoujian_arr_cnt_temp=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(arrived_key_prefix+m.getKey(), cntvalue+""); }else if("rcntrss".equals(m.getKey() )){ gexinghuapush_arr_cnt_temp=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(arrived_key_prefix+m.getKey(), cntvalue+""); }else if("rapp001".equals(m.getKey() )){ leshangdian_arr_cnt_temp=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(arrived_key_prefix+m.getKey(), cntvalue+""); }else if("rcntv01".equals(m.getKey() )){ neirong_arr_cnt_temp+=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(arrived_key_prefix+m.getKey(), cntvalue+""); }else if("rcntn02".equals(m.getKey() )){ neirong_arr_cnt_temp+=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(arrived_key_prefix+m.getKey(), cntvalue+""); }else if("rsys001".equals(m.getKey() )){ rsys001_arr_cnt_temp+=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(arrived_key_prefix+m.getKey(), cntvalue+""); }else if("rsys100".equals(m.getKey() )){ rsys001_arr_cnt_temp+=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(arrived_key_prefix+m.getKey(), cntvalue+""); }else if("1008".equals(m.getKey() )){ //pushtome_arr_cnt_temp+=cntvalue; qita_arr_cnt_temp+=cntvalue; //SidPushmsgCntFile.saveSidPushmsgCntValue(arrived_key_prefix+m.getKey(), cntvalue+""); }else{ //其他应用大于10W推送总量时,记录到文件中. //其他应用大于10W推送总量时,记录到文件中. //if(cntvalue>100000){ //SidPushmsgCntFile.saveSidPushmsgCntValue(arrived_key_prefix+m.getKey(), cntvalue+""); //} qita_arr_cnt_temp+=cntvalue; } } } /* * //到达量统计 long tianqi_arr_cnt_temp=0; long neirong_arr_cnt_temp=0; long qiyeyoujian_arr_cnt_temp=0; long gexinghuapush_arr_cnt_temp=0; long leshangdian_arr_cnt_temp=0; long gerenyoujian_arr_cnt_temp=0; long qita_arr_cnt_temp=0; long rsys001_arr_cnt_temp=0; long pushtome_arr_cnt_temp=0; */ String[] arripushindicators=new String[15]; arripushindicators[0]="0"; arripushindicators[1]="0"; arripushindicators[2]="0"; arripushindicators[3]="0"; arripushindicators[4]="0"; arripushindicators[5]="0"; arripushindicators[6]=tianqi_arr_cnt_temp+""; arripushindicators[7]=neirong_arr_cnt_temp+""; arripushindicators[8]=qiyeyoujian_arr_cnt_temp+""; arripushindicators[9]=gexinghuapush_arr_cnt_temp+""; arripushindicators[10]=leshangdian_arr_cnt_temp+""; arripushindicators[11]=gerenyoujian_arr_cnt_temp+""; arripushindicators[12]=rsys001_arr_cnt_temp+""; arripushindicators[13]=qita_arr_cnt_temp+""; arripushindicators[14]="0"; //sid到达消息分布统计 mysqlSpiderDSFacadeImpl.savePushIncatorToDB(11,arripushindicators); } }
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
暂时没有评论,来抢沙发吧~