Java Reference
In-Depth Information
Figure 3.2. Online solitaire is analogous to stateful sessions.
Stateful session bean instances are similarly dedicated to a single client. Stateful bean in-
stances are created when a client first accesses them, aren't shared with any other clients,
maintain state in instance variables on behalf of that client, and are destroyed when the
client ends the session. Stateful session beans are useful in modeling workflow-based mul-
tistep services where the service must hold state from one workflow state to the other. In
ActionBazaar, the bidder or seller Account Creator wizard services are ideal for stateful
session beans. These wizards consist of multiple steps like entering login information, bio-
graphical information, geographic information, billing information, and so on. The wizard
can also be cancelled at any stage of the workflow, ending the stateful session. In most ap-
plications, stateful services are relatively rare; bona fide cases for stateful session beans are
rarer still. We'll talk about this in greater detail in section 3.2 .
If online solitaire is a good analogy for stateful session beans, online multiplayer games,
especially massively multiplayer online role-playing games (MMORPGs), as shown in fig-
ure 3.3 , are a great analogy for singleton beans. Multiplayer games are concurrently ac-
cessed by all players and store the shared state common to all players. There's only one
live instance of the game that all players connect to. In essence, all clients share a single
extended session.
 
Search WWH ::




Custom Search