开发者

GWT + Object Persistence + Maintaining Data In Memory

开发者 https://www.devze.com 2022-12-12 17:41 出处:网络
I am currently carrying out research for the design and implementation of a web-based RSS aggregation system, with the aim being the use and evaluation of recommendation algorithms.

I am currently carrying out research for the design and implementation of a web-based RSS aggregation system, with the aim being the use and evaluation of recommendation algorithms.

This system will require a relatively interactive web-based UI (hence my interest in using GWT) and some form of data persistence to store RSS feed details and complex user profiles that will be used to provide recommendations (I have looked at Gilead for this).

My problem comes with updating the user profiles. The profiles will be updated by the users' interactions with the website, this means that there could potentially be a number of callbacks per second with data that will be used to update the user profile. The user profiles开发者_开发知识库 will have to be stored in some form of database, but accessing this every time a callback is made will be very inefficient.

As far as my understanding goes, my GWT application will be deployed on a web server, and will have runnable Java classes in it. However, this means that any objects that are created will only exist for the lifetime of that classes use.

Are there any methods for maintaining this data in memory, that can be efficiently accessed and modified by the Java classes within the GWT war, and carry out writes to the database periodically and through explicit calls.


Absolutely. GWT follows the same garbage collection rules as Java (not technically, but enough for our purposes). This means that you can make interaction record objects, and keeping them in memory is as simple as adding them into a list / any other data structure you want.

You can use GWT the same way you would a desktop app. A simple example would be to keep the data in a singleton and send it over to the server periodically. A singleton's life span would be from the time the code loads to the time the window is unLoaded, just as you would expect in a deskop app.

You can also hook on to the unload event of the page to send absolute last minute information back to the server just as your app is being shut down.

0

精彩评论

暂无评论...
验证码 换一张
取 消