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

洛阳网站建设的公司设计网站一般要多少钱

洛阳网站建设的公司,设计网站一般要多少钱,做网站费用需要分摊吗,网络推广文案Quartz是实现了序列化接口的#xff0c;包括接口#xff0c;所以可以使用标准方式序列化到数据库。 而Spring2.5.6在集成Quartz时却未能考虑持久化问题。 Spring对JobDetail进行了封装#xff0c;却未实现序列化接口#xff0c;所以持久化的时候会产生NotSerializable问题包括接口所以可以使用标准方式序列化到数据库。 而Spring2.5.6在集成Quartz时却未能考虑持久化问题。 Spring对JobDetail进行了封装却未实现序列化接口所以持久化的时候会产生NotSerializable问题这也是网上一直在那边叫嚣为什么不能持久化到数据库问题哥今天看了下Spring源码发现Spring对Quartz持久化的问题. 1. 不知道Spring未来会不会对持久化的支持不过我们可以有如下解决方案比如改写 Spring的代码实现序列化接口. 2. 不使用Spring的Fatory,自己实现任务的初始化. 既然Spring不支持持久化那么持久化任务还是自己编写实现吧否则每次都需要打包发布麻烦自己编写的类与Quartz完全兼容. 注意:为什么Spring不支持外配置任务可能也是考虑到这方面问题所以才不提供这些任务的执行化支持.[配置文件配置与数据库配置重复] 直接使用Quartz是支持序列化功能比如直接使用页面配置Quartz界面设置任务执行时间等属性。 通过配置实现的是不应该初始化到数据库否则直接在数据库中配置了。不过也是可以配置的通过改写JobDetailBean.代码如下: package org.frame.auth.service;  import java.util.Map;  import org.quartz.Job;   import org.quartz.JobDetail;   import org.quartz.Scheduler;   import org.springframework.beans.factory.BeanNameAware;   import org.springframework.beans.factory.InitializingBean;   import org.springframework.scheduling.quartz.DelegatingJob;   import org.springframework.scheduling.quartz.SchedulerFactoryBean;  public class PersistentJobDetailBean extends JobDetail   implements BeanNameAware, InitializingBean {  private static final long serialVersionUID  -4389885435844732405L;  private Class actualJobClass;  private String beanName;  /** * Overridden to support any job class, to allow a custom JobFactory * to adapt the given job class to the Quartz Job interface. * see SchedulerFactoryBean#setJobFactory */  public void setJobClass(Class jobClass) {  if (jobClass ! null  !Job.class.isAssignableFrom(jobClass)) {  super.setJobClass(DelegatingJob.class);  this.actualJobClass  jobClass;  }  else {  super.setJobClass(jobClass);  }  }  /** * Overridden to support any job class, to allow a custom JobFactory * to adapt the given job class to the Quartz Job interface. */  public Class getJobClass() {  return (this.actualJobClass ! null ? this.actualJobClass : super.getJobClass());  }  /** * Register objects in the JobDataMap via a given Map. * pThese objects will be available to this Job only, * in contrast to objects in the SchedulerContext. * pNote: When using persistent Jobs whose JobDetail will be kept in the * database, do not put Spring-managed beans or an ApplicationContext * reference into the JobDataMap but rather into the SchedulerContext. * param jobDataAsMap Map with String keys and any objects as values * (for example Spring-managed beans) * see SchedulerFactoryBean#setSchedulerContextAsMap */  public void setJobDataAsMap(Map jobDataAsMap) {  getJobDataMap().putAll(jobDataAsMap);  }  /** * Set a list of JobListener names for this job, referring to * non-global JobListeners registered with the Scheduler. * pA JobListener name always refers to the name returned * by the JobListener implementation. * see SchedulerFactoryBean#setJobListeners * see org.quartz.JobListener#getName */  public void setJobListenerNames(String[] names) {  for (int i  0; i  names.length; i) {  addJobListener(names[i]);  }  }  public void setBeanName(String beanName) {  this.beanName  beanName;  }  public void afterPropertiesSet() {  if (getName()  null) {  setName(this.beanName);  }  if (getGroup()  null) {  setGroup(Scheduler.DEFAULT_GROUP);  }  }  }   这里把Spring的ApplicationContext去掉了因为这个属性没有实现序列化接口。其他配置与原告一致: ?xml version1.0 encodingUTF-8?   !DOCTYPE beans PUBLIC -//SPRING//DTD BEAN//EN  http://www.springframework.org/dtd/spring-beans.dtd    beans default-autowirebyName  bean iddataSource classorg.springframework.jdbc.datasource.DriverManagerDataSource destroy-methodclose  property namedriverClassName valuecom.mysql.jdbc.Driver/  property nameurl   value![CDATA[jdbc:mysql://localhost:3306/txl?connectTimeout1000useUnicodetruecharacterEncodingutf-8]]/value  /property  property nameusername valueroot/  property namepassword value/  /bean  bean idjobDetail class  org.frame.auth.service.PersistentJobDetailBean  property namejobClass valueorg.frame.auth.service.PersistentJob/property  /bean  !-- bean idtrigger classorg.springframework.scheduling.quartz.SimpleTriggerBean --   !--         property namejobDetail refjobDetail/property--   !--         property namestartDelay value1000/property--   !--         property namerepeatInterval value3000/property--   !--         property namejobDataAsMap--   !--             map--   !--                 entry keymessage valuethis is trigger/entry--   !--             /map--   !--         /property--   !-- /bean--  bean idcronTrigger classorg.springframework.scheduling.quartz.CronTriggerBean   property namejobDetail refjobDetail/  property namecronExpression  value0/10 * * * * ?/value  /property  /bean  bean idschedulerFactory classorg.springframework.scheduling.quartz.SchedulerFactoryBean  property namedataSource refdataSource/property  property nameapplicationContextSchedulerContextKey  valueapplicationContextKey /  property nameconfigLocation valueclasspath:quartz.properties/  /bean  /beans   org.frame.auth.service.PersistentJob这个类很简单如下: package org.frame.auth.service;  import org.quartz.Job;   import org.quartz.JobExecutionContext;   import org.quartz.JobExecutionException;  public class PersistentJob implements Job  {  Override  public void execute(JobExecutionContext context) throws JobExecutionException {  System.out.println(spring quartz!);  }  }   有人可能会说你这种任务调度持久化就没有意义了是的一般持久化到数据库的代码如下: package org.frame.auth.service;  import java.util.Map;  import org.quartz.JobExecutionContext;   import org.quartz.JobExecutionException;   import org.quartz.StatefulJob;  public class PersistentJob implements StatefulJob  {  Override  public void execute(JobExecutionContext context) throws JobExecutionException {  // TODO Auto-generated method stub  Map map  context.getJobDetail().getJobDataMap();  System.out.println([context.getJobDetail().getName()]map.get(message));  map.put(message, updated Message);  }  }   这样的话信息message就会持久化到数据库中了.可以建立系统的连锁调度这根据你的业务需求了. 在Spring中配置的任务通过我这种修改是可以运行不过每次运行都需要把原先的任务删除否则会提示任务已经存在Quartz的优势是就算服务器停止下次重启能够恢复原先的任务并继续执行.
http://www.hkea.cn/news/14450860/

相关文章:

  • 做网站哪个公司好 快选宁陵建站宝找厂家用什么软件
  • 苏州新区网站制作建设推北京今天最新新闻
  • 平度城乡建设局网站做网站没有学历的人会吗
  • 素马网站制作开发html5单页网站模板
  • 网站开发公司凭证网站发布与推广计划
  • php网站内容管理系统上海软件外包公司有哪些
  • 网站建设入门培训做博客网站
  • 北京网站建设设计公司浩森宇特做商贸网站
  • 绍兴企业建站模板自考软件开发工具
  • 珠海网站建设 金蝶网站开发发现趋势
  • 如何选择合肥网站建设怀化网站建设企业
  • 罗定市城乡建设局网站网络营销方案包括哪些主要内容?
  • 做ptt有什么好的模板网站php网站开发业务
  • 网站打开速度突然变慢的原因宿迁市建设局网站
  • 连云港市住房和城乡建设局网站企业咨询端app
  • 江门网站建设工作wordpress开启vip会员查看
  • 厦门网站网页设学习网站的设置和网页的发布
  • 云南网站建设广州好蜘蛛网站建设公司
  • 诸城做网站的个人网站注册名称
  • 电商网站开发环境怎么写建筑云平台
  • 小学网站建设方案新织梦官网
  • 网站建设技能考试网站设计最好的公司
  • 做网站实验体会邢台视频优化方案
  • 一键查询注册过的网站安徽房地产网站建设
  • 河北住房和城乡建设厅网站驱动设计公司logo设计图片
  • jsp网站开发介绍静态网站建设的主要技术
  • 为什么要更新网站购物网站的建设
  • 上海网站建设哪家便宜wordpress运行php文件
  • 怎么样检查网站有没有做全站301企业网站建设的特点
  • 网站服务器租用价格 百度一下如何制作旅游网站