[jboss-user] [J2EE Design Patterns] - Concurent creating problem
johnmm1997
do-not-reply at jboss.com
Tue May 1 13:17:28 EDT 2007
I'm programming a system where people can submit "tasks" for evaluating.
When a person submit a task, the request go into a JMS queue, and later on a MDB is processing the task.
Task is an entity.
If there is no task with that id, i need to create it first (long operation)
The problem-
If there are 2 tasks request with the same id, and the id isnt in the db yet, the task is created twice (sometimes)
As a javaSE programmer, i thought about creating a singleton with concurentHashMap to flag which id's being created, but i learn that you cannot use singeltons in javaEE (mostly due to clustering scaling i guess)
so, what is the solution?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4042175#4042175
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4042175
More information about the jboss-user
mailing list