Stateless Session

StatelessSession Beans

If a client wants to call a single business method on a business object while not requiring its state. we can write a stateless session bean.

---

Clustering


After having used them extensively, I'm not a big fan of SSB's, or EJB's in general. Isn't an SSB a very un-OO arbitrary grouping of procedures? From a performance perspective, SSB's are supposed to be fast, but anything that doesn't have to worry about state is fast. How is it any different than a class with a bunch of static methods, and AOP transactional and security interceptors thrown in? Even without the AOP, is it really worth it to use SSB's just to avoid a few lines of transactional code?

Well, statelessnes gives you instant, effortless clustering - there is no (SSB's) state to deal with. So there is no need to replicate state across nodes in the cluster and no need to direct calls from the client to the same SSB instance. Also, there are no multithreading issues as far as SSB's member fields are concerned. And SSB pooling, while rather primitive, is a nice way to manage resources like connections and remote stubs. And remember that OO-ness is not the paradigm to end all paradigms.


EditText of this page (last edited August 21, 2014) or FindPage with title or text search