IntelliJ Java IDE
The moose likes EJB and Other Java EE Technologies and the fly likes Does entity bean lock work across a cluster or only for the one server it's executed in? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and Other Java EE Technologies
Reply Bookmark "Does entity bean lock work across a cluster or only for the one server it Watch "Does entity bean lock work across a cluster or only for the one server it New topic
Author

Does entity bean lock work across a cluster or only for the one server it's executed in?

john lazeraski
Greenhorn

Joined: Nov 14, 2011
Posts: 27
Hi all,

We're using an @Asynchronous method to pull some data from a table, and depending on some criteria, we update one row with a status. The problem we came across is that our async method can potentially (and has as we discovered in testing) be called simultaneously by two (or more) incoming requests to the method. Because of this, it seems it's possible that while one of the threads is reading the table, another could be updating the status, and we seem to get into trouble here. I've not been able to find any good info with regards to locking entities, how to use them correctly with multiple threads and so on. But more so, as the title suggests, we're also a bit worried with scaling our service and having multiple servers in a cluster that all refer to the same DB table. Does the entity bean locking mechanism work on the table level, or only within the container server the lock is initiated from? Is there some way to make sure it's on the DB table or row instead of just the container it's executed in?

Thank you.
 
 
subject: Does entity bean lock work across a cluster or only for the one server it's executed in?
 
Threads others viewed
Doubt on the level of lock and concurency
Weblogic Doubt
Deleted Entity, Which MDB
EntityBean Life Cycle and ejbSelect(), ejbFind
Can Entity Bean synchronize data when put across multiple apps server with no cluster
IntelliJ Java IDE