I have read the EJB restrictions regarding the use of threading but am still unclear as to what I can and cannot do. In particular I have a singleton within my system that is accessed by multiple EJB's, so the questions are: a) Can I synchronise the methods of the Singleton b) Within the singleton I have pooled resource, I want to add a wait/notify strategy for the EJBs to acquire/release these, is this allowed? Regards Paul.
Strictly speaking, what you suggest would be breaking the EJB Spec. It doesn't matter that the code is in a different class, because it still executes within the context of the EJB. Despite that warning, I have two comments: 1) Containers typically do not enforce these areas of the specification, so your code should work. 2) Sometimes you have to break the rules... I am not saying to use or not use the solution you suggest, because I don't know enough about your problem. I would give it some more thought to see if there wasn't another solution. Why not post the problem that you are ultimately trying to solve? Someone here may be able to give a better alternative.