最新(xīn)軟件|熱(rè)門排行|軟件分類|軟件(jiàn)專題(tí)|廠商大全

您的位置: 首頁編程開發編程工具 → quartz all 1.8.5.jar

quartz all 1.8.5.jar

quartz all 1.8.5.jar 網友(yǒu)評分(fèn):8
  • 軟件大(dà)小:422KB
  • 軟件(jiàn)語言:中(zhōng)文(wén)
  • 軟件類型:國產軟件
  • 軟件類別:免費軟件 / 編程工(gōng)具
  • 更新時間:2017-10-09 16:01
  • 運行環境:WinAll, WinXP, Win7, Win8, Win10
  • 軟件等級(jí):4級(jí)
  • 軟件廠商(shāng):
  • 官(guān)方網站:http://www.chithemodel.com/
好評:50%頂一個
壞評(píng):50踩一個

同類相關(guān)軟件

軟件(jiàn)介(jiè)紹

軟件(jiàn)標(biāo)簽: quartzall 編(biān)程工具

quartz all 1.8.5.jar是(shì)一款非(fēi)常好用的(de)編程工具(jù),功能強大(dà),使(shǐ)用方(fāng)便,有需(xū)要(yào)的朋友不(bú)要錯過了,還等什麽,快約上你的小夥伴,一起來綠色資源(yuán)網下載使用!

軟(ruǎn)件介紹(shào)

在(zài)數據庫中創建Quartz所需表(sql語句可以在quartz-1.8.5\docs\dbTables中找到(dào),這(zhè)裏以(yǐ)oracle數據庫(kù)為(wéi)例):

qrtz_blob_triggers,

qrtz_calendars,

qrtz_cron_triggers,

qrtz_fired_triggers,

qrtz_job_details,

qrtz_job_listeners,

qrtz_locks,

qrtz_paused_trigger_grps,

qrtz_scheduler_state,

qrtz_simple_triggers,

qrtz_triggers,

qrtz_trigger_listeners

軟件說明

加(jiā)入quartz 所需要的(de)包:

放入jboss-4.2.3.GA\server\all\lib下

先(xiān)把jboss自帶的quartz jar刪除掉。包括(quartz-ra.rar)都(dōu)刪除掉。

commons-dbcp-1.3.jar

commons-pool-1.5.4.jar

jta-1.1.jar

log4j-1.2.14.jar

quartz-all-1.8.5.jar

slf4j-api-1.6.0.jar

slf4j-log4j12-1.6.0.jar

3.創建quartz-service.xml文(wén)件(放入jboss-4.2.3.GA\server\all\deploy下),文件內容如(rú)下:

<?xml version="1.0" encoding="UTF-8"?>

<server>

<mbean code="org.quartz.ee.jmx.jboss.QuartzService"

name="user:service=QuartzService,name=QuartzService">

<attribute name="JndiName">Quartz</attribute>

<attribute name="StartScheduler">true</attribute>

<attribute name="Properties">

#============================================================================

# Configure Main Scheduler Properties

#============================================================================

#==========集(jí)群名稱(chēng),每個節(jiē)點的名字都一(yī)樣===========

org.quartz.scheduler.instanceName = quartzjbossdemopartitionName

#==========集群每個(gè)節點ID=======

org.quartz.scheduler.instanceId = AUTO

#============================================================================

# Configure ThreadPool

#============================================================================

#=======線程====

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool

org.quartz.threadPool.threadCount = 25

org.quartz.threadPool.threadPriority = 5

#============================================================================

# Configure JobStore

#============================================================================

org.quartz.jobStore.misfireThreshold = 60000

org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX

org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate

org.quartz.jobStore.dataSource = QUARTZ

org.quartz.jobStore.tablePrefix = QRTZ_

org.quartz.jobStore.isClustered = true

org.quartz.jobStore.clusterCheckinInterval = 30000

#============================================================================

# Configure Datasources

#============================================================================

#=================數據庫(kù)寫(xiě)上自己(jǐ)的數據庫======

org.quartz.dataSource.QUARTZ.driver = oracle.jdbc.driver.OracleDriver

org.quartz.dataSource.QUARTZ.URL = jdbc:oracle:thin:@192.168.111.24:1521:db org.quartz.dataSource.QUARTZ.user = rootmq

org.quartz.dataSource.QUARTZ.password = rootmq

org.quartz.dataSource.QUARTZ.maxConnections = 5

org.quartz.dataSource.QUARTZ.validationQuery=select 0 from dual

</attribute>

</mbean>

</server>

4. java代碼

每一個 Quartz Job 必須有一個實現(xiàn)了 org.quartz.Job 接口的具體類.

public class JbossJob implements Job {

public void execute(JobExecutionContext arg0) throws JobExecutionException {

System.out.println("hello jbossJob .....");

}

}

5. 具體調用(yòng)

public class StartOrCloseScheduler implements Serializable{

/**

*

*/

private static final long serialVersionUID = -2266323478579408291L;

private static Logger myLogger = Logger.getLogger(StartOrCloseScheduler.class);

private static Scheduler sched = null;

/**

* 啟動任務

* jobName: job名稱

* jobGroupName: job組名(míng)稱

* triggerName: trigger名稱(chēng)

* triggerGroupName:trigger組名稱

*/

@SuppressWarnings("rawtypes")

public static void start(String jobName,String jobGroupName,

String triggerName,String triggerGroupName,

Class c, String str) {

try {

InitialContext ctx = new InitialContext();

sched = (Scheduler) ctx.lookup("Quartz");

System.out.println("Scheduler:" + sched);

} catch (NamingException e) {

e.printStackTrace();

}

JobDetail job = new JobDetail(jobName,jobGroupName, c);

System.out.println("JobDetail:" + job);

Trigger trigger = new CronTrigger(triggerName,triggerGroupName);

System.out.println("Trigger:" + trigger);

try {

((CronTrigger) trigger).setcronExpression(str);

sched.scheduleJob(job, trigger);

System.out.println("job:" + job);

sched.start();

} catch (Exception e) {

myLogger.error("開啟一(yī)個任務"+jobName+e.getMessage());

e.printStackTrace();

}

}

/**

* 移除一個任務(wù)

* @param jobName: job名稱(chēng)

* @param jobGroupName: job組名稱

* @param triggerName: trigger名稱

* @param triggerGroupName: trigger組名稱

* @throws SchedulerException

*/

public static void removeJob(String jobName,String jobGroupName,

String triggerName,String triggerGroupName) {

try {

InitialContext ctx = new InitialContext();

sched = (Scheduler) ctx.lookup("Quartz");

} catch (NamingException e) {

e.printStackTrace();

}

try {

//停止(zhǐ)觸發器

sched.pauseTrigger(triggerName,triggerGroupName);

//移除觸(chù)發器

sched.unscheduleJob(triggerName,triggerGroupName);

//刪(shān)除任(rèn)務

sched.deleteJob(jobName,jobGroupName);

} catch (SchedulerException e) {

myLogger.info("移除一個任(rèn)務"+jobName+e.getMessage());

}

}

}

軟件截圖

下載地址(zhǐ) 電腦(nǎo)版(bǎn)

點(diǎn)擊報錯 軟件無法下載或(huò)下載後無法使用,請點擊報(bào)錯,謝謝!

用戶評(píng)論

熱門評論

最新評論

發表評(píng)論 查(chá)看所(suǒ)有評論(0)

昵稱:
請不(bú)要評論無意義或(huò)髒(zāng)話(huà),我(wǒ)們所有評論(lùn)會有(yǒu)人工審核(hé).
字數(shù): 0/500 (您的評(píng)論需要經過審核(hé)才能顯示)