[jboss-user] [EJB 3.0] - EJB with synchronized
merabi
do-not-reply at jboss.com
Fri Jul 20 03:20:14 EDT 2007
hi, fellaz.
i created a class that sums up the prices of the ads and updates the DB records.
the single price of the test ad was 10.
it does what it supporsed to do when the concurrent access is "1".
i did the test using Apache Bench.
used "ab -n 50 -c 1 <update url>".
the sum of the price was 500, which was ok.
the problem appeared when i did "ab -n 50 -c 2 <update url>".
the total supposed to be 500, but it was something like 350.
i changed the code a bit with the "synchronized" keyword and made it thread-safe, and it worked fine.
but the problem is that the EJB prohibits the "synchronized" keyword.
Is there anyway (annotation or methods) to solve this problem?
One way that I'm thinking of is to use Singleton method and use "synchronized" keyword inside of the Singleton class...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066046#4066046
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4066046
More information about the jboss-user
mailing list