Total members 11893 |It is currently Sat Nov 02, 2024 2:48 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Extending Quartz Scheduler Job Interface , by implementing it using a new class named QuartzJob , and creating a new job interface which is passed to the execution function "execute", in the following example the JobDetails class is used to get the parameters passed to the current Job, the parameter in this case is our general and new Job Interface.
java code
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
* Quartz job implementation .
*/
public class QuartzJob implements Job {

private JobDetail jobDetail;

public QuartzJob() {

}

public void execute(JobExecutionContext arg0) throws JobExecutionException {
Object[] param = { arg0 };

jobDetail = arg0.getJobDetail();
if (jobDetail != null) {
JobDataMap jobDataMap = jobDetail.getJobDataMap();
if (jobDataMap != null) {
//job = (IJob) jobDataMap.get("JOB");

// job.execute();
} else {
// Do something
}

}
}

}


Following in the new IJob interface, you can extend and customize this job to meet your software requirements. it is easy task to redesign this new Job interface by adding new functions and fields. The IJob interface then can be used to in all your software model .
java code
public interface IJob {

public void execute();


public void setName(String name);
public String getName();
public String getGroup();
public void setGroup(String group);
}




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Extending Quartz Scheduler Job Interface
 extending enum in java     -  
 Java extending org.apache.log4j.Logger     -  
 What is an Interface? !!!!     -  
 Iterator interface     -  
 how to implement an interface     -  
 about Java IO-interface     -  
 Implement an interface in php     -  
 List interface     -  
 java interface example     -  
 Is garbageCollector a Class or interface?     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com