wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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: 8904

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
 
 
subject: newbie - Stateless SessionBean calling static methods
 
Similar Threads
Thread safety of static variables in EJB
thread safety of helpmer methods in ejb
static methods and EJB
Question about helper class of session bean
Question about helper class of session bean