[EJB 3.0] - EJB with synchronized
by merabi
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
18Â years, 9Â months
[JBoss Seam] - Re: Gavin, Can you tell me how run seam2.0 on tomcat6 ???
by oncetime2008
I can't run it.
Today I waste another day for seam,I don't many time to waste.I just want to say:"I can run jsf+facelets+dynafaces, I can run jpa, why i spend much more time,but i can't run seam."
Before i want to jsf,seam,jpa for my 3 layers javaee program, but now i must find another middleware instead of seam.
Maybe one or two months passed, I will study seam again.But it's not now.I'm a student, and tired.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066043#4066043
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4066043
18Â years, 9Â months
[JBoss Seam] - Re: Conversation Timeout and Redirect
by chubby
Ok, I think I understand the problem:
1. @Begin does not start a new conversation until after the method completes.
2. Thus, the object I created in the method was actually outjected to the "current" conversation.
3. The conversation time out is not enforced until just prior to the redirect. So the "current" conversation is the one thats about to be timed out.
4. My outjected variable is destroyed when the "current" conversation is timed out.
5. I get a new (long running) conversation just prior to my redirect as well, one without my outjected variable.
I guess what confuses me now is why doesn't seam either:
a. avoid outjecting to a soon to be timed out conversations.
or
b. Allow the promotion of soon to be timed out conversations to long running conversations and skip the timeout. Although I can see this still being a problem for cases where you just want to use the temporary conversation.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066033#4066033
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4066033
18Â years, 9Â months