這一篇介紹關於任務的啟動停止這些操作,廢話不多說。
任務啟動停止
啟動任務
停止任務void
start()
throws schedulerexception;
// 啟動任務
void
shutdown()
throws schedulerexception;
//直接關閉scheduler
void
shutdown
(boolean waitforjobstocomplete)
throws schedulerexception;
//shutdown(true)表示等待所有正在執行的任務執行完畢後關閉scheduler
//shutdown(false),即shutdown()表示直接關閉scheduler
以下是測試停止的方法:public
class
quartzjob1
implements
job}
這裡就不展示結果了,但是通過測試可以得到,一旦shutdown(),,就不能直接通過start()直接啟動了,需要從新例項化scheduler傳出定時任務配置,再start()才能從新啟動。如果使用的是standby(),則可以直接通過start()直接啟動任務。public
class
quartzjobutil
}catch
(schedulerexception e)
}//獲取乙個預設的scheduler物件
private
static scheduler getscheduler()
catch
(schedulerexception e)
return null;
}//停止任務--再啟動需要從新初始化
public
static
void
stopscheduler()
catch
(schedulerexception e)
}//暫停所有任務執行
public
static
void
standbyscheduler()
catch
(schedulerexception e)
}public
void
deletejob
(string jobname, string jobgroupname)
catch
(schedulerexception e)
}}
暫停和從新啟動job
暫停任務:
從新啟動定時job/**
*@see #resumejob(jobkey)
*/void
pausejob
(jobkey jobkey)
throws schedulerexception;
/***@see #resumejobs(org.quartz.impl.matchers.groupmatcher)
*/void
pausejobs
(groupmatcher
matcher)
throws schedulerexception;
/** * pause the
with the given key.* * @see #resumetrigger(triggerkey)
*/void
pausetrigger
(triggerkey triggerkey)
throws schedulerexception;
/***@see #resumetriggers(org.quartz.impl.matchers.groupmatcher)
*/void
pausetriggers
(groupmatcher
matcher)
throws schedulerexception;
/** @see #resumeall()
* @see #pausetriggers(org.quartz.impl.matchers.groupmatcher)
* @see #standby()
*/void
pauseall()
throws schedulerexception;
實現:/**
* @param matcher the matcher to evaluate against known paused groups
* @see #pausejobs(groupmatcher)
*/void
resumejobs
(groupmatcher
matcher)
throws schedulerexception;
/** *
* @see #pausetrigger(triggerkey)
*/void
resumetrigger
(triggerkey triggerkey)
throws schedulerexception;
/** * @param matcher the matcher to evaluate against know paused groups
* @see #pausetriggers(org.quartz.impl.matchers.groupmatcher)
*/void
resumetriggers
(groupmatcher
matcher)
throws schedulerexception;
/** * @see #pauseall()
*/void
resumeall()
throws schedulerexception;
//停止其中的任務
public
static
void
pausejob
(string jobname, string jobgroupname)
catch
(schedulerexception e)
}//從新開始任務
public
static
void
restartjob
(string jobname, string jobgroupname)
catch
(schedulerexception e)
}
(二)任務堆疊
任務堆疊的建立 1 為了方便定義任務堆疊,在檔案os cpu.h中定義了乙個資料型別os stk typedef unsigned int os stk 該型別長度為16位 2 在定義任務堆疊的棧區時,只要定義乙個os stk型別的陣列即可。例如 define task stk size 512 定...
實驗二任務一
1.掌握如何建立乙個activity 2.掌握如何在activity中新增控制項並進行事件處理 3.掌握如何通過intent啟動另外乙個 activity 4.掌握如何通過intent在多個 activity 之間傳遞資料 5.掌握activity的生命週期 裝有android開發環境的計算機 1....
專案二(任務五)
任務五 管理linux系統的使用者與使用者 使用者可分為普通使用者和超級使用者,除了使用者以外還有使用者組,所謂使用者組就是使用者的集合,centos組中有兩種型別,私有組和標準組。當建立乙個新使用者時,若沒有指定它所屬的組,centos就建立乙個和該使用者相同的私有組,此私有組中只包括使用者自己,...