绝地求生duos什么意思test server什么意思

TEST2 _ 多玩COC专区
您的当前位置:>>
14:33:42 条|来源:|作者:|
      
      
从当前等级升级到下一等级
所需资源:
5,000,000&
从当前等级升级到下一等级
所需时间:
可建造/升级的设施
可建造/升级的兵种
当前等级可建造的总人口上限:
3,500,000&
4,500,000&
3,000,000&
4,800,000&
添加到收藏夹
10月更新:
阵型推荐:
阵型推荐:
最新数据:
精彩视频:
精彩视频:
实用分享:
看完本文后有何评价?
已有0人评价,点选表情后可看到其他玩家的表态。
<span onclick='javascript:if(document.all){clipboardData.setData("Text",location.href);this.innerHTML="[文章地址已复制]";}'
class="btn">[与更多人共享]
※ ※ ※ ※ ※ ※ ※ ※The page is temporarily unavailable
nginx error!
The page you are looking for is temporarily unavailable.
Please try again later.
Website Administrator
Something has triggered an error on your
This is the default error page for
nginx that is distributed with
It is located
/usr/share/nginx/html/50x.html
You should customize this error page for your own
site or edit the error_page directive in
the nginx configuration file
/etc/nginx/nginx.conf.The page is temporarily unavailable
nginx error!
The page you are looking for is temporarily unavailable.
Please try again later.
Website Administrator
Something has triggered an error on your
This is the default error page for
nginx that is distributed with
It is located
/usr/share/nginx/html/50x.html
You should customize this error page for your own
site or edit the error_page directive in
the nginx configuration file
/etc/nginx/nginx.conf.播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
视频:【绝地求生:大逃杀】H1Z1和武装突袭3的“私生子...
发送到手机 / 微信 / 朋友圈
请扫描下列二维码
嵌入代码:
*通用代码支持手机播放哦
方式一:扫一扫
支持各类二维码扫描软件
方式二:发一发
免费发送App到手机
请输入正确的手机号码
看不清验证码不正确
该短信不收取任何费用
方式三:下一下
下载App观看
还有更多攻略和游戏礼包等着你
游戏新鲜报
大型角色扮演
H1Z1本周上升视频
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
播放: 评论:
宝贝陪你玩
畅游视频网页游戏YOYO手游
完美游戏台
网络视听许可证在项目中有一个需求,需要灵活配置调度任务时间,并能自由启动或停止调度。 有关调度的实现我就第一就想到了Quartz这个开源调度组件,因为很多项目使用过,Spring结合Quartz静态配置调度任务时间,非常easy。比如:每天凌晨几点定时运行一个程序,这只要在工程中的spring配置文件中配置好spring整合quartz的几个属性就好。 Spring配置文件 引用&bean
& &property ref="simpleService" /& &property value="test" /& &/bean&&bean
& &property ref="jobDetail" /& &property value="0 0/50 * ? * * *" /& &/bean& &bean
& &property& &list&&ref bean="cronTrigger"/& &/list& &/property& &/bean& 这种配置就是对quartz的一种简单的使用了,调度任务会在spring启动的时候加载到内存中,按照cronTrigger中定义的 cronExpression定义的时间按时触发调度任务。但是这是quartz使用“内存”方式的一种配置,也比较常见,当然对于不使用spring的项目,也可以单独整合quartz。方法也比较简单,可以从quartz的doc中找到配置方式,或者看一下《Quartz Job Scheduling Framework 》。 但是对于想持久化调度任务的状态,并且灵活调整调度时间的方式来说,上面的内存方式就不能满足要求了,正如本文开始我遇到的情况,需要采用数据库方式集成 Quartz,这部分集成其实在《Quartz Job Scheduling Framework 》中也有较为详细的介绍,当然doc文档中也有,但是缺乏和spring集成的实例。 一、需要构建Quartz数据库表,建表脚本在Quartz发行包的docs/dbTables目录,里面有各种数据库建表脚本,我采用的Quartz 1.6.5版本,总共12张表,不同版本,表个数可能不同。我用mysql数据库,执行了Quartz发行包的docs/dbTables/tables_mysql_innodb.sql建表。 二、建立java project,完成后目录如下
三、配置数据库连接池 配置jdbc.properties文件 引用jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/quartz?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true jdbc.username=root jdbc.password=kfs cpool.checkoutTimeout=5000 cpool.minPoolSize=10 cpool.maxPoolSize=25 cpool.maxIdleTime=7200 cpool.acquireIncrement=5 cpool.autoCommitOnClose=true 配置applicationContext.xml文件 引用&?xml version="1.0" encoding="UTF-8"?& &beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-2.5.xsd" &
&context:component-scan base-package="com.sundoctor"/& &!-- 属性文件读入 --& &bean
& &property& &list& &value&classpath:jdbc.properties&/value& &/list& &/property& &/bean& &!-- 数据源定义,使用c3p0 连接池 --& &bean
destroy-method="close"& &property value="${jdbc.driverClassName}" /&&property value="${jdbc.url}" /&&property value="${jdbc.username}" /&&property value="${jdbc.password}" /&&property value="${cpool.minPoolSize}"/&&property value="${cpool.minPoolSize}" /&&property value="${cpool.maxPoolSize}" /&&property value="${cpool.acquireIncrement}" /&
&property value="${cpool.maxIdleTime}"/& &/bean&&/beans& 这里只是配置了数据连接池,我使用c3p0 连接池,还没有涉及到Quartx有关配置,下面且听我慢慢道来。 四、实现动态定时任务
什么是动态定时任务:是由客户制定生成的,服务端只知道该去执行什么任务,但任务的定时是不确定的(是由客户制定)。 这样总不能修改配置文件每定制个定时任务就增加一个trigger吧,即便允许客户修改配置文件,但总需要重新启动web服务啊,研究了下Quartz在Spring中的动态定时,发现 引用&bean
&property ref="schedulerJobDetail"/&
&property&
&value&0/10 * * * * ?&/value&
&/property& 中cronExpression是关键,如果可以动态设置cronExpression的值,就可以顺利解决问题了。这样我们就不能直接使用org.springframework.scheduling.quartz.CronTriggerBean,需要自己实现一个动态调度服务类,在其中构建CronTrigger或SimpleTrigger,动态配置时间。 动态调度服务接口: Java代码 package com.sundoctor.quartz.
import java.util.D
import org.quartz.CronE
public interface SchedulerService {
* 根据 Quartz Cron Expression 调试任务
* @param cronExpression Quartz Cron 表达式,如 "0/10 * * ? * * *"等
void schedule(String cronExpression);
* 根据 Quartz Cron Expression 调试任务
* @param name Quartz CronTrigger名称
* @param cronExpression Quartz Cron 表达式,如 "0/10 * * ? * * *"等
void schedule(String name,String cronExpression);
* 根据 Quartz Cron Expression 调试任务
* @param cronExpression Quartz CronExpression
void schedule(CronExpression cronExpression);
* 根据 Quartz Cron Expression 调试任务
* @param name Quartz CronTrigger名称
* @param cronExpression Quartz CronExpression
void schedule(String name,CronExpression cronExpression);
* 在startTime时执行调试一次
* @param startTime 调度开始时间
void schedule(Date startTime);
* 在startTime时执行调试一次
* @param name Quartz SimpleTrigger 名称
* @param startTime 调度开始时间
void schedule(String name,Date startTime);
* 在startTime时执行调试,endTime结束执行调度
* @param startTime 调度开始时间
* @param endTime 调度结束时间
void schedule(Date startTime,Date endTime);
* 在startTime时执行调试,endTime结束执行调度
* @param name Quartz SimpleTrigger 名称
* @param startTime 调度开始时间
* @param endTime 调度结束时间
void schedule(String name,Date startTime,Date endTime);
* 在startTime时执行调试,endTime结束执行调度,重复执行repeatCount次
* @param startTime 调度开始时间
* @param endTime 调度结束时间
* @param repeatCount 重复执行次数
void schedule(Date startTime,Date endTime,int repeatCount);
* 在startTime时执行调试,endTime结束执行调度,重复执行repeatCount次
* @param name Quartz SimpleTrigger 名称
* @param startTime 调度开始时间
* @param endTime 调度结束时间
* @param repeatCount 重复执行次数
void schedule(String name,Date startTime,Date endTime,int repeatCount);
* 在startTime时执行调试,endTime结束执行调度,重复执行repeatCount次,每隔repeatInterval秒执行一次
* @param startTime 调度开始时间
* @param endTime 调度结束时间
* @param repeatCount 重复执行次数
* @param repeatInterval 执行时间隔间
void schedule(Date startTime,Date endTime,int repeatCount,long repeatInterval) ;
* 在startTime时执行调试,endTime结束执行调度,重复执行repeatCount次,每隔repeatInterval秒执行一次
* @param name Quartz SimpleTrigger 名称
* @param startTime 调度开始时间
* @param endTime 调度结束时间
* @param repeatCount 重复执行次数
* @param repeatInterval 执行时间隔间
void schedule(String name,Date startTime,Date endTime,int repeatCount,long repeatInterval); } 动态调度服务实现类: Java代码 package com.sundoctor.quartz.
import java.text.ParseE import java.util.D import java.util.UUID;
import org.quartz.CronE import org.quartz.CronT import org.quartz.JobD import org.quartz.S import org.quartz.SchedulerE import org.quartz.SimpleT import org.springframework.beans.factory.annotation.A import org.springframework.beans.factory.annotation.Q import org.springframework.stereotype.S
@Service("schedulerService") public class SchedulerServiceImpl implements SchedulerService {
private JobDetail jobD
@Autowired
public void setJobDetail(@Qualifier("jobDetail") JobDetail jobDetail) {
this.jobDetail = jobD
@Autowired
public void setScheduler(@Qualifier("quartzScheduler") Scheduler scheduler) {
this.scheduler =
public void schedule(String cronExpression) {
schedule(null, cronExpression);
public void schedule(String name, String cronExpression) {
schedule(name, new CronExpression(cronExpression));
} catch (ParseException e) {
throw new RuntimeException(e);
public void schedule(CronExpression cronExpression) {
schedule(null, cronExpression);
public void schedule(String name, CronExpression cronExpression) {
if (name == null || name.trim().equals("")) {
name = UUID.randomUUID().toString();
scheduler.addJob(jobDetail, true);
CronTrigger cronTrigger = new CronTrigger(name, Scheduler.DEFAULT_GROUP, jobDetail.getName(),
Scheduler.DEFAULT_GROUP);
cronTrigger.setCronExpression(cronExpression);
scheduler.scheduleJob(cronTrigger);
scheduler.rescheduleJob(name, Scheduler.DEFAULT_GROUP, cronTrigger);
} catch (SchedulerException e) {
throw new RuntimeException(e);
public void schedule(Date startTime) {
schedule(startTime, null);
public void schedule(String name, Date startTime) {
schedule(name, startTime, null);
public void schedule(Date startTime, Date endTime) {
schedule(startTime, endTime, 0);
public void schedule(String name, Date startTime, Date endTime) {
schedule(name, startTime, endTime, 0);
public void schedule(Date startTime, Date endTime, int repeatCount) {
schedule(null, startTime, endTime, 0);
public void schedule(String name, Date startTime, Date endTime, int repeatCount) {
schedule(name, startTime, endTime, 0, 0L);
public void schedule(Date startTime, Date endTime, int repeatCount, long repeatInterval) {
schedule(null, startTime, endTime, repeatCount, repeatInterval);
public void schedule(String name, Date startTime, Date endTime, int repeatCount, long repeatInterval) {
if (name == null || name.trim().equals("")) {
name = UUID.randomUUID().toString();
scheduler.addJob(jobDetail, true);
SimpleTrigger SimpleTrigger = new SimpleTrigger(name, Scheduler.DEFAULT_GROUP, jobDetail.getName(),
Scheduler.DEFAULT_GROUP, startTime, endTime, repeatCount, repeatInterval);
scheduler.scheduleJob(SimpleTrigger);
scheduler.rescheduleJob(name, Scheduler.DEFAULT_GROUP, SimpleTrigger);
} catch (SchedulerException e) {
throw new RuntimeException(e);
} } SchedulerService 只有一个多态方法schedule,SchedulerServiceImpl实现SchedulerService接口,注入org.quartz.Schedulert和org.quartz.JobDetail,schedule方法可以动态配置org.quartz.CronExpression或org.quartz.SimpleTrigger调度时间。 五、实现自己的org.quartz.JobDetail 在上一步中SchedulerServiceImpl需要注入org.quartz.JobDetail,在以前的静态配置中 引用&bean
& &property ref="simpleService" /& &property value="testMethod" /& &/bean&中使用org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean。在这里使用org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean。会报 引用Caused by: java.io.NotSerializableException: Unable to serialize JobDataMap for insertion into database because the value of property 'methodInvoker' is not serializable: org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.serializeJobData(StdJDBCDelegate.java:3358) at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.insertJobDetail(StdJDBCDelegate.java:515) at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJob(JobStoreSupport.java:1102) ... 11 more 异常,google了一下,没有找到解决方法。所以在这里不能使用org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean。,不能pojo了,需要使用org.springframework.scheduling.quartz.JobDetailBean和org.springframework.scheduling.quartz.QuartzJobBean实现自己的QuartzJobBean,如下: Java代码 package com.sundoctor.example.
import org.quartz.JobExecutionC import org.quartz.JobExecutionE import org.quartz.T import org.springframework.scheduling.quartz.QuartzJobB
public class MyQuartzJobBean extends QuartzJobBean {
private SimpleService simpleS
public void setSimpleService(SimpleService simpleService) {
this.simpleService = simpleS
protected void executeInternal(JobExecutionContext jobexecutioncontext) throws JobExecutionException {
Trigger trigger = jobexecutioncontext.getTrigger();
String triggerName = trigger.getName();
simpleService.testMethod(triggerName);
} MyQuartzJobBean继承org.springframework.scheduling.quartz.QuartzJobBean,注入的SimpleService如下: Java代码 package com.sundoctor.example.
import java.io.S
import org.slf4j.L import org.slf4j.LoggerF import org.springframework.stereotype.S
@Service("simpleService") public class SimpleService implements Serializable{
private static final long serialVersionUID = 334343L;
private static final Logger logger = LoggerFactory.getLogger(SimpleService.class);
public void testMethod(String triggerName){
//这里执行定时调度业务
(triggerName);
public void testMethod2(){
("testMethod2");
} } SimpleService主要执行定时调度业务,在这里我只是简单打印一下log日志。SimpleService需要实现java.io.Serializable接口,否则会报 引用Caused by: java.io.InvalidClassException: com.sundoctor.example.service.SimpleS class invalid for deserialization at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:587) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732) ... 64 more异常。 配置applicationContext-quartz.xml文件: 引用&?xml version="1.0" encoding="UTF-8"?& &!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"& &beans& &bean & &property& &ref bean="dataSource" /& &/property& &property value="applicationContextKey" /& &property value="classpath:quartz.properties"/& &/bean& &bean
& &property& &value&com.sundoctor.example.service.MyQuartzJobBean&/value& &/property& &property& &map& &entry key="simpleService"& &ref bean="simpleService" /& &/entry& &/map& &/property& &/bean&&/beans& quartzScheduler中没有了 引用&property& &list& ... &/list& /property& 配置,通过SchedulerService动态加入CronTrigger或SimpleTrigger。 在红色的 引用&property& &map& &entry key="simpleService"& &ref bean="simpleService" /& &/entry& &/map& &/property& 中需要注入调度业务类,否则会报空指指错误。 dataSource:项目中用到的数据源,里面包含了quartz用到的12张数据库表; applicationContextSchedulerContextKey: 是org.springframework.scheduling.quartz.SchedulerFactoryBean这个类中把spring上下文以key/value的方式存放在了quartz的上下文中了,可以用applicationContextSchedulerContextKey所定义的key得到对应的spring上下文; configLocation:用于指明quartz的配置文件的位置,如果不用spring配置quartz的话,本身quartz是通过一个配置文件进行配置的,默认名称是quartz.properties,里面配置的参数在quartz的doc文档中都有介绍,可以调整quartz,我在项目中也用这个文件部分的配置了一些属性,代码如下: 引用org.quartz.scheduler.instanceName = DefaultQuartzScheduler org.quartz.scheduler.rmi.export = false org.quartz.scheduler.rmi.proxy = false org.quartz.scheduler.wrapJobExecutionInUserTransaction = false org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount = 10 org.quartz.threadPool.threadPriority = 5 org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true org.quartz.jobStore.misfireThreshold = 60000 #org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX #org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.HSQLDBDelegate org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate #org.quartz.jobStore.useProperties = true org.quartz.jobStore.tablePrefix = QRTZ_ org.quartz.jobStore.isClustered = false org.quartz.jobStore.maxMisfiresToHandleAtATime=1 这里面没有数据源相关的配置部分,采用spring注入datasource的方式已经进行了配置。 六、测试 运行如下测试类 Java代码 package com.sundoctor.example.
import java.text.ParseE import java.text.SimpleDateF import java.util.D
import org.springframework.context.ApplicationC import org.springframework.context.support.ClassPathXmlApplicationC
import com.sundoctor.quartz.service.SchedulerS
public class MainTest {
* @param args
public static void main(String[] args) {
ApplicationContext springContext = new ClassPathXmlApplicationContext(new String[]{"classpath:applicationContext.xml","classpath:applicationContext-quartz.xml"});
SchedulerService schedulerService = (SchedulerService)springContext.getBean("schedulerService");
//执行业务逻辑...
//设置调度任务
//每10秒中执行调试一次
schedulerService.schedule("0/10 * * ? * * *");
Date startTime = parse(" 22:16:00");
Date endTime = parse(" 22:20:00");
// 21:50:00开始执行调度
schedulerService.schedule(startTime);
// 21:50:00开始执行调度, 21:55:00结束执行调试
//schedulerService.schedule(startTime,endTime);
// 21:50:00开始执行调度,执行5次结束
//schedulerService.schedule(startTime,null,5);
// 21:50:00开始执行调度,每隔20秒执行一次,执行5次结束
//schedulerService.schedule(startTime,null,5,20);
//等等,查看com.sundoctor.quartz.service.SchedulerService
private static Date parse(String dateStr){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.parse(dateStr);
} catch (ParseException e) {
throw new RuntimeException(e);
} 输出 引用[ 00:08:50]INFO com.sundoctor.example.service.SimpleService(line:17) -62-49fe-b4ce-be7e7a29459f [ 00:10:20]INFO com.sundoctor.example.service.SimpleService(line:17) -62-49fe-b4ce-be7e7a29459f [ 00:10:30]INFO com.sundoctor.example.service.SimpleService(line:17) -62-49fe-b4ce-be7e7a29459f [ 00:10:40]INFO com.sundoctor.example.service.SimpleService(line:17) -62-49fe-b4ce-be7e7a29459f [ 00:10:50]INFO com.sundoctor.example.service.SimpleService(line:17) -62-49fe-b4ce-be7e7a29459f [ 00:11:00]INFO com.sundoctor.example.service.SimpleService(line:17) -62-49fe-b4ce-be7e7a29459f [ 00:11:10]INFO com.sundoctor.example.service.SimpleService(line:17) -62-49fe-b4ce-be7e7a29459f 这样只是简单的将quartz trigger名称打印出来。 这样通过SchedulerService就可以动态配置调度时间。其实SchedulerService 还可扩展,比如可以注入多个JobDetail,调度不同的JobDetail。
quartzWithSpring.rar (5 MB)
下载次数: 7
为什么Thinkphp
中的&if&&v
最新教程周点击榜
微信扫一扫

我要回帖

更多关于 绝地求生duos什么意思 的文章

 

随机推荐