• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Ideas Needed to insert Action execution time in DB !!

Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I briefly explain here my requirement
After sending the response from my application i need to insert the Total action execution time along with some request parameters in DB i do so because Sending the response and insertion in DB should be asynchronous.

1. With the below code i am able to get the action execution time and the parameters passed to it.
How to fetch value of a variable which i have assigned in my action class ??

2. Timer interceptor just logs the time taken by the action is it possible to assign the Timetaken value to a variable ??

Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Getting an arbitrary property from an arbitrary action isn't possible without reflection, as far as I know. You have to know what methods you can call on an action in order to do it without reflection.

If you're always getting the *same* property from actions then you can create an interface with a getter for that property and have your actions implement that interface. The interceptor would then cast the action to that interface and call interface methods.

I suppose you could create an interface that returns a map, and set named properties in that map from within the action, if you need it to be totally general-purpose, but that entails more busywork in the actions.

Using a reflection helper could probably reduce the clutter in the interceptor to a line or two, I guess.

(Not very organized, but those are my initial thoughts :)
    Bookmark Topic Watch Topic
  • New Topic