you could use a dispatcher instead of a request filter, inserted after
the asset dispatcher.
That way, only non-asset requests trigger the db update.
You could adapt your filter to only fire the update on non-asset
requests by explicitly checking the url (for matching patterns, for
instance: ^.*\.png$ and so forth).
You could have a separate thread that does the update. Then you have
a service (which, naturally, will have to be threadsafe) that your
request filter calls into to record all of the updates (multiple
updates from the same user within the given timespan could be
consolidated into a single update). The separate thread asks this
service for the pool of changes on a regular basis (Quartz package
would be useful here) and commits them.
There are other ways you could accomplish this, as well.
If you're interested in using a Quartz-based solution, it looks like
chenillekit is planning on adding it at some point (they have a quartz
module, but it doesn't look like there's actually any code in there
yet). Alternatively, I wrote an integration module for
TapestryQuartz that you're welcome to use (contact me off list). I'll
be releasing it for general use at some point, but I need to refine
the documentation for it.
Robert
On Aug 14, 2008, at 8/143:05 AM , Otho wrote:
Thank you very much for the answer. Works perfectly!
But this brought up a new question. The UserActivityFilter is used
to track
a users last activity to check for "active users at the moment". The
simplistic approach I use at the moment updates a database table
with a
reference to user and a timestamp. Using a requestfilter then
obviously
leads to a lot of database roundtrips per user-activity, since every
asset
triggers the filter.
How would you track useractivity in a real world application? A
resolution
of about 1 minute would suffice, but it shouldn't be much above that.
Regards,
Otho
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]