S
S
stp0082015-07-11 01:30:00
Java
stp008, 2015-07-11 01:30:00

How does a stateful bean store state?

Subject. How does it determine the uniqueness of a client, and when should a new instance be created for a new client? By HTTP session?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bromzh, 2015-07-14
@bromzh

The HTTP session is used to identify the client.
The Web part (servlet, jax-rs, etc) has all sorts of resources that can be injected through annotations (in the case of jax-rs, for example) or pulled directly from request (in the case of servlets). One of them is HttpSession. The session id is stored there, by which the client can be identified. The EJB layer has its own SessionContext, which is not directly associated with the HttpSession (but uses it to determine the calling client). This SessionContext is already distributed to the entire application, and (sort of) it is where the states of stateful beans are stored.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question