Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Action Class - Logging timing

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a quick and easy way to log timing for the execute method of the action class? I want to keep track of how long the execute method took to complete. I extended the process() method of the RequestProcessor and kept track of how long the processActionPerform() method took to complete. However, I am not comfortable with having to modify native struts code in the process() method. Is there another less invasive way to implement log timing?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One possible way to do this would be to write a base Action class that extends Action, and then have all your Action classes extend your base Action class. You could then implement your logging in the base Action class.
 
Leonard Murro
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the base action class - Would I extend on any particular method or would I need to create a new method? How could I get access to the before and after time of the execute method?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are many ways to do this, but one way would be to definie an abstract method named something other than execute (e.g. myExecute) that your subclasses must implement. Then call this method from your base Action class's execute method. You could then get the begin time before calling myExecute and the end time after myExecute returns. This would also give you an opportunity to do whatever other tasks you want every Action to perform, such as checking security roles, checking for valid session, etc.
[ April 10, 2006: Message edited by: Merrill Higginson ]
 
Water proof donuts! Eat them while reading this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic