Shared Stateful Session
I have been considering the following as an EJB Architecture:
Assume we have a situation where the following conditions are met:
1)  We have a state which we need to track
2)  The state may be reconstructed (at some expense) from the database
3)  There a number of objects each with their own state
4)  When data is entered to change the state, that data rarely changes again.
A couple of examples would be a) airline seats where we need to track the
available seats on any flight but rarely need to access who is in the seat
or how they paid for the seat.  b) Class registration where we need to know
the number of students in a class but not who they are.
Why not represent object state as a shared, long-lived stateful session
bean. In all clustered systems stateful beans are singletons (with possible
mirrored backup). As long as all changes go through the singleton bean, the
in-memory state should represent the state in the database. If the server
goes down, the state can be rebuilt from persistent data.
      In the case of airline reservations, all reservations go through the
stateful bean and the state reflects the current seats filled.
     As long as there are a number of objects of this type, load balancing
in a cluster comes from distributing the session beans to different
servers. Serialization should not be an issue as long as large numbers of
users are not attempting to access the same object at the same time.
     One prerequisite is a way for users to get a handle to the shared bean.
Clearly some service (Stateless bean needs to track these and return them
to the user.
     It does alter the one per user model of a stateful bean but I still do
not see any good reason why this model is not a good one for a large number
of problems where users need to see a synopsis of all data which is
expensive to reconstruct, enough instances exist so load can be balanced
against instances and no one instance is hit so heavily that serialization
is an issue. Comments???

==============================================================
LordJoe - Java Training and Consulting
http://www.LordJoe.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to