Re: Mouse tracking with Tapestry

"Thiago H. de Paula Figueiredo" <[email protected]>
Newsgroups gmane.comp.java.tapestry.user
Message-ID <CAE_88GamgEa1N6-UKZB16878iiuMELjWRTsBRJteD8QJeHLcvQ@mail.gmail.com>
On Sat, Apr 8, 2017 at 11:13 AM, Phyambre <[email protected]> wrote:

> Hi Thiago,
>

Hi!

So if I move the code of the task from onActivate() to setupRender() as
> Geoff suggested, I will not have the task on onSubmit() anymore, so I
> cannot check whether the user finished before the deadline. A solution
> is getting the task from database both on setupRender() and onSubmit(),
> but I don't know if this is more efficient than leave the code in
> onActivate().
>

Yes, it is more efficient, because that code will only be called when you
actually need it.


> The point is, I wanted the task and the stage and the text/quiz to be
> obtained only once from the database, and kept in memory until the user
> finishes the stage. The objects are big and storing them in the session
> may be a bit overkill. Maybe make a cache in the server (concurrent
> HashMap<userId, currentTask>) is the solution? In principle, the number
> of users that can use my app is limited let us say less than 300 so
> maybe such a cache is viable.
>

In both cases, you're storing this big object in the process' memory. I'd
go for a cache.

-- 
Thiago
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.