When your timer goes off and you collect your statistics, do you need
to share those statistics (the actual DataContext) elsewhere?  If not,
you could just create a new local DataContext in your timer handler
methods.

/dev/mrg


On 1/19/07, Gary Jarrel <[EMAIL PROTECTED]> wrote:
Hi All!

I've got a web app using struts, spring and cayenne. I use a web
application listener to setup the thread bound data context for any
given actions. All database access is abstracted away via a number of
DAOs. For any given action (all managed by spring) the required DAOs
are injected and are able to access the data context as it has been
bound to the thread. All works very well.

Now we've created a number of objects which collect various stats on
the data in the DB. These are executed at various time intervals and
are managed by Spring and the Quartz API. My question is what is the
best practice in providing a data context for these types of objects.
Can't use a listener as no Action is being executed - Spring simply
instantiates the object and executes the specified method. Should I
perhaps go the way described in the Cayenne/Spring example? Seems as
though there is a fair bit of implementation for just a few objects.

Any suggestions would be much appreciated!

Thank you!

- garyj

Reply via email to