简体   繁体   中英

@Schedule annotation and timeout in EJB bean

What happens if I have @Scheduled task which runs every 5 seconds and sometimes it takes more than 5 seconds to complete this task? EJB container knows how to deal in such scenario or I need to care it by myself? Thank you.

PS My EJB bean annotated by @Startup and @Singleton, and I run it on Websphere 8.0

I think you are good because you bean is annotated with @Singleton . EJB beans are synchronized unless you explicitly mark methods with @Asynchronous . So if a cron execution(a thread) is in progress then other cron run(another thread) will have to wait for the first one to finish.

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