File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes wait() & notify() and EJB restrictions Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "wait() & notify() and EJB restrictions " Watch "wait() & notify() and EJB restrictions " New topic
Author

wait() & notify() and EJB restrictions

Paul Rhoades
Greenhorn

Joined: Aug 01, 2002
Posts: 20
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.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: wait() & notify() and EJB restrictions
 
Similar Threads
Using multiple threads
Why no compilation failure
synchronized - wait()
Problem with wait() & notify()
reader interface, wait() then go