Before you begin
This step requires advanced knowledge of developing J2EE Applications and the Scheduler programming interfaces.
Steps for this task
public void recreateTasks(String schedulerJNDIName) throws Exception { InitialContext ctx = new InitialContext(); Scheduler s = (Scheduler)ctx.lookup(schedulerJNDIName); Iterator tasks = null;; try { tasks = s.findTasksByName("%"); } catch (SchedulerNotAvailableException e) { e.printStackTrace(); throw e; } // Iterate through each task and recreate it. while(tasks.hasNext()) { TaskInfo curTask = (TaskInfo) tasks.next(); int retries=0; boolean deleted=false; TaskStatus status=null; // It's best to include each cancel/create // in it's own transaction (not shown here). while(!deleted && retries < 5) { try { // Delete the task. s.cancel(curTask.getTaskId(), true); deleted = true; // Create a new one. int createRetries = 0; boolean created = false; while(!created && createRetries<5) { try { s.create(curTask); created = true; } catch (Exception e) { ++createRetries; Thread.sleep(5000); } } if (!created) { System.out.println("Task Not Created: " + curTask.getTaskId()); } } catch (Exception se) { ++retries; Thread.sleep(5000); } } if (!deleted) { System.out.println("Task Not Deleted: " + curTask.getTaskId()); } } }