i've got a requirement whereby, i have to execute n tasks at certain times of occasions. i've got a database which may retain the values required to execute the job - java. and that i come with an apache webserver set up on the home windows platform.

could somebody please guide me in achieving this.

You should use Quartz api with this pourpose.

Quarta movement is arranging API its simple to use and does initialization of arranging.

You should use simple trigger with nanosecond and repeat jobs and hang repeat times. Advance Trigger CronTrigger works exactly same unix cron. In CronTrigger we are able to define, selected days e.g. Wednesday, Friday weekly, monthly and yearly.

This is a sample tutorial that describes using it

Quarta movement with Simple Servlet

web.xml

<web-app>
 <display-name>timer</display-name>

    <servlet>
     <servlet-name>InitializeServlet</servlet-name>
     <servlet-class>com.cron.InitializeServlet</servlet-class>
     <load-on-startup>1</load-on-startup>
    </servlet>

</web-app>

InitializeServlet.java

package com.cron;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

public class InitializeServlet extends HttpServlet {

 public void init() throws ServletException {

    try {
        System.out.println("Initializing NewsLetter PlugIn");

        CronScheluder objPlugin = new CronScheluder();

    }
    catch (Exception ex) {
      ex.printStackTrace();
    }

  }

}

CronScheluder.java

package com.cron;

import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerFactory;
import org.quartz.impl.StdSchedulerFactory;

public class CronScheluder {

    public CronScheluder() throws Exception {

        SchedulerFactory sf = new StdSchedulerFactory();

        Scheduler sche = sf.getScheduler();

        sche.start();

        JobDetail jDetail = new JobDetail("Newsletter", "NJob", MyJob.class);

        //"0 0 12 * * ?" Fire at 12pm (noon) every day
        //"0/2 * * * * ?" Fire at every 2 seconds every day

 CronTrigger crTrigger = new CronTrigger("cronTrigger", "NJob", "0/2 * * * * ?");

        sche.scheduleJob(jDetail, crTrigger);
    }
}

MyJob.java

package com.cron;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

public class MyJob implements Job {

    public void execute(JobExecutionContext context)
     throws JobExecutionException {

      System.out.println("Cron executing ");

    }
}

You may either do that via:

  • a linux cron job which is asking for a particular Link to your application via wget or curl
  • Quarta movement, a Java library for arranging

ALso, apache does not appear to possess any relation together with your requirement.