This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I have read many messages that indicate that the criteriaFind method doesn't need to be synchronized. I am very confused by this because there may be concurrent usage of the criteriaFind method. Also how is everyone breaking the functionality of this method up. I am trying not to make anything complex, but I fell that the parsing of the criteria should be done in a separate class that I call ParseUtilities. Any thoughts?
Hi Terry, The reason is that only write lock needed as it is written in the specification. It is called also dirty read. This kind of SELECT also (may) used in SQL. Br, Ban
Joined: Sep 29, 2000
The problem that I see is that let's say Client A and Client B both call the criteriaFind method at the same time. The method itself will have two threads running in it at the same time. Let's say that Client A is at the beginning of the method and Client B is at the end. This could cause problems. The variables that Client A and Client B are using are going to be trampled on if the method or block is synchronized. Also, it looks like some people are loading data from the file into their program. I don't understand how that is flexible. Doesn't it make sense to keep the data where it is at? We can't guarantee that it is not a huge file.