public static void createQueue() throws WTException{
ScheduleQueue category = (ScheduleQueue) QueueHelper.manager.getQueue(
"New Queue for Test", wt.queue.ScheduleQueue.class);
if (category == null) {
ScheduleItem schItem = ScheduleItem.newScheduleItem();
schItem.setItemDescription("task test");
schItem.setItemName("task");
schItem.setTargetClass(Test2.class.getName());
schItem.setTargetMethod("list");
schItem.setImmediateMode(false);
schItem.setQueueName("New Queue for Test");
schItem.setPeriodicity(5L);
schItem.setToBeRun(-1L);
wt.org.WTPrincipal principal = SessionHelper.manager
.getAdministrator();
WTPrincipalReference reference = WTPrincipalReference
.newWTPrincipalReference(principal);
schItem.setPrincipalRef(reference);
long millis = System.currentTimeMillis();
Timestamp timestamp = new Timestamp(millis);
Timestamp timestamp2 = Timestamp.valueOf("2009-07-03 9:25:00.000");
schItem.setStartDate(timestamp2);
timestamp = new Timestamp(millis + 5L);
schItem.setNextTime(timestamp);
SchedulingHelper.service.addItem(schItem, null);
}
else{
System.out.println("it has a same queue........");
}
}
create queue
最新推荐文章于 2023-04-23 17:09:07 发布
7058

被折叠的 条评论
为什么被折叠?



