Hi Bethana,

Why dont u try using the EJBTimerService?

Mahen


On Thu, 16 Sep 2004 07:40:53 -0700 (PDT), bethana kumar
<[EMAIL PROTECTED]> wrote:
> 
> 
> 
> Dear All
> 
> I have the following requirements.I need your suggestions for implementing.
> 
> I have an webbased system,in which enduser creates a case about an employee and 
> assign this to Inspector for inspection.
> 
> Inspector login to webbased system then he schedules this inspection for 30 days.
> 
> Now we have to develop a sytem which will send an email to Inspector one week before 
> scheduled day(i.e 23rd day) depending of inspection case status.
> 
> All the inspection details will be available in Oracle database.
> 
> Framework used by us are JBoss 3.1.5 with tomcat and struts along with oracle 
> database.
> 
>  
> 
> Currently I am following design
> 
> --------------------------------
> 
> I have an Timer class (i.e java.util.Timer) which will be initiated at Jboss 
> Startup(i.e Servlet will call this class at its init() method),the Timer Class 
> schedule a task (i.e RemindTask).
> 
> import java.util.*;
> 
> public class Reminder {
> 
> Timer timer;
> 
> Calendar StartingTime=null;
> 
> //send reminders once in a day
> 
> private static final long DEFAULT_INTERVAL = 1000 * 60 * 60 * 24;
> 
> public Reminder() {
> 
> timer = new Timer();
> 
> StartingTime = Calendar.getInstance();
> 
> // Starting at 7:00 AM in the Morning 
> 
> StartingTime.set(Calendar.HOUR,7);
> 
> StartingTime.set(Calendar.MINUTE,0);
> 
> StartingTime.set(Calendar.SECOND,0);
> 
> StartingTime.set(Calendar.MILLISECOND,0);
> 
> timer.schedule(new RemindTask(), StartingTime.getTime(),DEFAULT_INTERVAL);
> 
> 
> 
> }
> 
> class RemindTask extends TimerTask {
> 
> public void run() {
> 
> System.out.println(" run()!");
> 
> this.doPrcoess();
> 
> 
> 
> }
> 
> public void doPrcoess()
> 
> {
> 
> System.out.println("I have to start prcoess() ");
> 
> //Here i am planning to get data from Oracle for the currentday and do some business 
> process
> 
> //then i will send an email
> 
> }
> 
> }
> 
> public static void main(String args[]) {
> 
> System.out.println("About to schedule task.");
> 
> new Reminder();
> 
> System.out.println("Task scheduled.");
> 
> }
> 
> }
> 
>  
> 
> Now my questions are
> 
> 1)Is it a good design by considering Database accesses and Threads(i.e it should not 
> resource hungry application)
> 
> 2)
> 
> I really need you guys intelligent idea to how implement the case on the server in 
> java.
> 
> Framework used by us are JBoss 3.1.5 with tomcat and struts along with oracle 
> database.
> 
>  
> 
> Thanks
> 
> Bethana
> 
>  
> 
>  
> 
>  
> 
> ________________________________
> Do you Yahoo!?
> vote.yahoo.com - Register online to vote today! 
> 
>

Reply via email to