Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8081677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:48:58+00:00 2026-06-05T16:48:58+00:00

We use interceptors to measure the execution time of a bean’s public method invocation.

  • 0

We use interceptors to measure the execution time of a bean’s public method invocation. nonetheless, when a bean’s method invoke other private methods, it seems to ignore the audit interceptor.

How can we measure the execution time of private methods as well?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:49:00+00:00Added an answer on June 5, 2026 at 4:49 pm

    Using AOP

    You could implement a benchmarker using an Aspect-Oriented Programming library like AspectJ.

    For instance, see:

    • this SO question on Catching Private or Inner Methods with AspectJ,
    • or this article on Profiling with AspectJ.

    Using a Profiler

    • You could implement your own agent extension (for instance, for JProfiler).
    • Or you could give up on your interceptors and simply inspect from any profiler allow to capture snapshots and to record execution times.

    Using JVMTI

    Which is what some profilers do, actually.

    You could resort to using the JVMTI API (not entirely sure this would fly, to be honest) to implement your own code inspector and directly hook yourself into the JVM.


    The Sneaky and Evil Inlining Issue

    Regarding jb’s (valid) concern in his answer that private methods might be inlined at either compilation time or runtime, some JVMs may not do it or allow to disable this feature.

    • Oracle’s JRockit has a -XnoOpt option that would disable optimizations (including this particular one).
    • Oracle/Sun’s HotSpot at least used to have -XX:-Inline (not sure it still exists or does anything).

    However, it means you don’t measure exactly what you’d have in production when the inlining is activated. Still, probably handy for inspecting your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some mechanics to measure method execution time. Simply at start of method
I know one can use interceptors before a method call by using the @AroundInvoke
I want to use method interceptors in spring 3 to accomplish logging in my
use strict; use warnings; use Time::HiRes qw(sleep); use Test::WWW::Selenium; use Test::More no_plan; use Test::Exception;
I use Token Session to prevent duplicate form submits, but the first time I
Is there a way to use Castle DynamicProxy interceptors with EF entities, like the
Simple question... I want to use Ninject Interceptors to take care of my NFRs,
I'm working on a project where I want to use Interceptors to log usage
Triggers seems like a simple solution for Audit logging. Why should I use Interceptors?
I want to define a method interceptor in a Java program in other words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.