<p>As per my understanding stateless session beans are used to code the business logic. They can not store data in their instance variables because their instance is shared by multiple requests. So they seem to be more like Singleton classes. However the difference is contain creates (or reuses from pool) the separate instance of stateless session beans for every request.</p>

<p>After googling I could find the reasoning that the Java EE specification says they are suppose to be single threaded. But I can't get the reason why the are specified to be <strong>SINGLE THREADED</strong>?</p>

[{'answer_id': 29739, 'author': 'Alexander Stolz', 'author_id': 2450, 'author_profile': 'https://Stackoverflow.com/users/2450', 'pm_score': 4, 'selected': True, 'text': '<p>The SLSBs are single threaded because of the TX Context, Principal is associated with a bean instance when it is called. These beans are pooled and unless the max pool size is reached are processed in separate threads ( Vendor dependent).</p>\n\n<p>If SLSBs were designed thread safe every call would have looked like a servlet doGet/Post with request info containing Tx Context , Security Context info and etc. So at least the code looks clean (developer dependent). </p>\n'}, {'answer_id': 30334, 'author': 'David G', 'author_id': 3150, 'author_profile': 'https://Stackoverflow.com/users/3150', 'pm_score': 2, 'selected': False, 'text': '<p>The primary reason stateless session beans are single threaded is to make them highly scalable for the container. The container can make a lot of simplifying assumptions about the runtime environment. A second reason is to make life easier for the developer because  the developer doesn\'t have to worry about any synchronization or re-entrancy in his business logic because the bean will never be called in another thread context.</p>\n\n<p>I remember the reasoning being discussed in the reviews of the original EJB 1.0 specification. I would look at the goals section of the specification. See <a href="http://java.sun.com/products/ejb/docs.html" rel="nofollow noreferrer">http://java.sun.com/products/ejb/docs.html</a> for the list of specifications.</p>\n'}]
['https://Stackoverflow.com/questions/29734', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/959/']