Trying to figure out how to best architect a component with the following characteristics:
This component will be used by multiple threads in an ApplicationServer. It should be initialized at application startup as its initialization will be fairly expensive (via some type of SpringFactory); during the initialization, it must connect to the DataSource, retrieve initialization data from the DB, complete initialization and be a Singleton so it can be used quickly without expensive initialization every time. When external events modify its data in the DB, it must recognize the data change in the DB, read the fresh data from DB and RELOAD itself, then continue to live as a Singleton but with NEW data values...
Not sure about how to implement the notification mechanism to this component so it will recognize that its DB data has changed and that it's time to reload itself.... Would some type of Observer pattern work for me? Example please.
Would it be better to implement this component as an Entity EJB?
All ideas are welcome.
Thanks,
James


Reply With Quote
