File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes EJB scheduler and thread synchronization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB scheduler and thread synchronization " Watch "EJB scheduler and thread synchronization " New topic

EJB scheduler and thread synchronization

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
I have an EJB scheduled job run at 00:30AM every day, it will read an external file in the system, like /usr/myproject/feed.xml. inside the scheduler, I didn't create any multiple threads.

Question is, when I deploy codes to multiple cluster / instances, do I need to worry about synchronized issue ? is it possible that the feed.xml is accessed by two threads from two instances at the same time ?


Ranganathan Kaliyur Mannar

Joined: Oct 16, 2003
Posts: 1101

Which version of EJB are you using? If it is 3.1, you can create an EJB as a singleton with the @Singleton annotation - this along with @Schedule annotation should make it simpler to wrote code.

I agree. Here's the link:
subject: EJB scheduler and thread synchronization
It's not a secret anymore!