简体   繁体   中英

Schedule a task

Iam using jboss5.1.x, EJB3.0

I need to schedule a task in my application. which way would you recommend me to do it according to version I am using below?

I heard about SAR, but i am not sure if there is a way which is more appropriate or updated to do it nowdays

thanks,

ray.

I would recommend Quartz

Quartz is a full-featured, open source job scheduling service that can be integrated with, or used along side virtually any Java EE or Java SE application - from the smallest stand-alone application to the largest e-commerce system. Quartz can be used to create simple or complex schedules for executing tens, hundreds, or even tens-of-thousands of jobs; jobs whose tasks are defined as standard Java components that may execute virtually anything you may program them to do. The Quartz Scheduler includes many enterprise-class features, such as JTA transactions and clustering.

Java EE API javax.ejb. TimedObject supports the feature.

I also recommend using Quartz. In case you cannot use it, don't forget the EJB 3.0 standard has the concept of EJB Timer services. You can read more here .

In Java you have TimerTask , you can schedule a task to run at the particular time.But i would recommend Quartz .According to your scenario , you have built in EJB Timer class available , hope will solve the purpose.

Please read this article

http://mhashem.wordpress.com/2010/03/29/java-quartz-scheduler-ejb-3-0-timer-service-and-java-timer-task-when-to-use-each/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM