This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Using a EJB with threading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Using a EJB with threading" Watch "Using a EJB with threading" New topic

Using a EJB with threading

William Ross

Joined: Jul 06, 2006
Posts: 12
As I understand it the ejb takes care of threading for us? What I am trying to do is syncronize a method so that only one thread can be using it at a time. However, I get an error when I try to use syncronize. What I think is happening is the ejb is running multiple instances of this method at a time due to threading. But I want only one flow of control within this method. Sorry if this sounds confusing; I can clarify more... thanks.
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3700

In J2EE, you generally should avoid any and all thread management. In particular, you should never spawn threads.

What do you need synchronized methods for? If it is for a static object, there are better solutions to manage singletons in a J2EE environment.

My Blog: Down Home Country Coding with Scott Selikoff
Consider Paul's rocket mass heater.
subject: Using a EJB with threading
Similar Threads
NX: Passed B&S 387/400
about syncronization
Class Lock in Threads
Please Answer.