crontab framework?

Discussions

EJB design: crontab framework?

  1. crontab framework? (5 messages)

    Hello
    I'm faced to the problem that do a framework that act like the crontab on the unix systems, so I notice that a solution with threads (TimerTask, Timer, etc) will not be desired, by many reasons, like cpu time, numbers of process in memory, I need to assure the end of the task even if the father class that create the threads die.

    So anybody knows any solutions to this matter?, I mean, I need to implement a system that trigger some actions on specified dates. maybe some tricks with the Visitor pattern???

    Thanks in advance
      Mauricio

    Threaded Messages (5)

  2. crontab framework?[ Go to top ]

    I'm not sure I understand why you don't want to use a thread:
    1) CPU time: the thrad can sleep and wake up only when it has a task to schedule. This solution hardly uses any CPU.
    2) Number of processes: I don't think this should be a concern. Applications start processes all the time, it's no problem. It only becomes a problem at the design level when you really start a whole lot of processes. All you need here is one thread, not a thread per scheduled task. So really, I don't see a problem.
    3) Task finishes running: threads do finish their run even if the "class that created them" dies. There is no coupling between threads and their creators (other than automatically inherited InheritableThreadLocals and ThreadGroup associations which are really not relevant).

    Gal
  3. crontab framework?[ Go to top ]

    Gal,
    Thanks for you reply, actually I can't understand how a Thread could be running if the vm is exited for an unknow reason, like non handled exception?, I mean? the thread could run if this happen?? so if this is tru then I try to use the thread classes!

    Thanks again
      Mauricio
  4. crontab framework?[ Go to top ]

    No, of course if the VM exited the threads won't finish running! However, an unhandled exception doesn't kill the VM. It only kills the thread where it occured. If you have other threads running (say the scheduler thread) it will continue to run. Of course you do need to make sure there are no unhandled exceptions in the scheduler thread. But I don't see why this should pose a problem.

    Gal
  5. crontab framework?[ Go to top ]

    EJB Timer service (EJB 2.1)

    http://www.theserverside.com/home/thread.jsp?thread_id=15994

    See also:

    http://www.theserverside.com/resources/article.jsp?l=Job-Scheduling-In-J2EE-Applications

    http://sourceforge.net/projects/quartz/

    http://clockwork.sourceforge.net/

    http://www.simscomputing.com/products/flux/

    http://www.acelet.com/super/SuperScheduler/index.html
  6. Unix Crontab[ Go to top ]

    Well if your application is running on a Unix System, I think you can go for
    crontab as we have done for similar requirement and its quite consistant in terms its work and time precission.

    Bye

    bobby