Hi Alexander,
you are right, this database notification mechanism is similar
to the Observer
pattern. Indeed, there is a cost to implement a
notification mechanism, but the cost could be limited by using
a mixed pull&push model :
one can imagine sending after each database change an event with
a type (CREATE,UPDATE,DELETE), on the record number on which the
event occured. This is the push part.
Each client has then the responsability to request more information
from the database (for the CREATE & UPDATE type). This is the pull
part.
The other approach for the clients to keep synchronized with the
database would be to poll periodicaly (perform search and get the
whole database list). This approach creates more traffic that the
one described above (because client request data on the database
even if nothing change, and the requests are less focused).
If the requirement is to keep the clients synchronized with the
database (which is not explicitly the case in SCJD), one of the
solution above have to be implemented, and the traffic increase
is unavoidable, in my opinion. So for the thousands of clients...
well, run the server on a speed-light machine ;-).
On second though, i think i won't implement a database notification
mechanism neither. I will just take extra care with the currently
selected record (to ensure that when the record is selected, the
record data are up to date), and during update (read again the record
before update to be sure there will be no update(s) lost).
Thanks for your feedback.
Gilles
PS : RMI supports a callback feature to manage this kind of database
update notification process :
http://www.ryerson.ca/~dgrimsha/courses/cps841/RMICallbacks.html