Normally we use singleton instance for business / dao layer. What is the reason behind pooling stateless session beans in case of EJBs?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
The "stateless" in the name refers to session conversation state, i.e. state that persists between invocations of the bean, retained for the duration of the session. However, stateless session beans are still permitted to have instance variables. Those instance variables should not relate to the conversation state, but are "shared" between clients.
In other words, stateless session beans are not guaranteed thread safe.
As a result, the container should ensure that only one thread is executing a given instance of a stateless session bean at one time, hence the need for a pool of them.