0

I am using the commonJ TimerManager for sending notification emails.

Now I need to execute the Timer once a week on Monday but I am facing some problems with the configuration.

How can I set the timer for once a week on a specific day ?

        TimerManager tm = (TimerManager) ic.lookup(tm_lookup);
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yy:HH:mm:SS");
        String exeDate = "23-10-2013:13:00:00";
        Date date = dateFormat.parse(exeDate);
        long oneDay = 24 * 60 * 60 * 1000;
        long oneWeek = 24 * 60 * 60 * 1000 * 7;


        tm.scheduleAtFixedRate(new MyTimer(), ?, ?);

Thanks

angus
  • 3,210
  • 10
  • 41
  • 71
  • the arguments are `scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)` – Caffeinated May 05 '14 at 22:44
  • Or you could use something like Quartz-Scheduler which gives you access to Cron like execution. – Totoro May 05 '14 at 23:30
  • something like that tm.scheduleAtFixedRate(new MyTimer(), TimeUnit.DAYS.toDays(2), oneWeek); ?? – angus May 06 '14 at 14:59

0 Answers0