Someone posted this as a possible interview question on the J2EE list:
>>Ex: I have a list of country codes and country names. I only want to read
the list form the database once a day (since new countries are not created
very often) and only want one version in memory for all to share. How would
you write your application?<<
I can see several options here:
1. Write a regular old Singleton - but now you'll have one copy per JVM,
which doesn't satisfy the 'read once a day' requirement.
2. Use a JNDI javax.naming.Reference to bind the "singleton" object into
JNDI, and look
it up that way. I don't know enough about Reference to fully
understand the cross-JVM issues here.
3. External RMI-based server, bound into JNDI. Satisfies all requirements,
but a little slow (YARC - yet another remote call).
4. A single entity bean instance with Commit Option A (caching) or one of
the proprietary "read-only" or "supressed ejbLoad()" entity beans that
various vendors support.
Any other solutions?
----------------------
Kenneth DeLong
Senior Consultant
Valtech, Inc.
Cell phone: 510-517-5839
Every complex problem has a simple answer - and it's always wrong.
===========================================================================
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".