Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB scheduler and thread synchronization

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?

Thanks

 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic