wood burning stoves*
The moose likes EJB and other Java EE Technologies and the fly likes newbie - Stateless SessionBean calling static methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "newbie - Stateless SessionBean calling static methods" Watch "newbie - Stateless SessionBean calling static methods" New topic
Author

newbie - Stateless SessionBean calling static methods

William Edwards
Greenhorn

Joined: Aug 31, 2005
Posts: 1
Hi,

I need some advice. I have a stateless session bean that has no static methods or variables as mandated by EJB spec. However, I have plain java classes (helper classes) that have static methods. My question is : can I call these static methods (in helper java classes) from my session Bean? What about multithreading?

My belief is that once my bean method becomes live and calls static methods in my helper classes, it will never get preempted until this thread (ie, bean method) terminates. What happens when another instance of my stateless session bean becomes live too. Will this new thread interfere with the static methods of my helper class?
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

There would not be any problem as long as those static methods do not access any static data which may get corrupted when multiple session instances access the static methods. Otherwise you are safe.


Groovy
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: newbie - Stateless SessionBean calling static methods