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 8328375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:25:18+00:00 2026-06-09T01:25:18+00:00

I have some (static) Java methods. I have a pointcut to fire on the

  • 0

I have some (static) Java methods.

I have a pointcut to fire on the execution of any of these methods:

pointcut calculation() : execution(* myMethod_*(..));

Now I want to measure the time of each execution seperately.
The problem is that executions may fire at any time, while other executions still run.
I thought about two advices, before() and after(), which identify the caller to manage timers for different callers.

before() : calculation() {

}

after() : calculation() {

}

How do I implement that?

  • 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-09T01:25:19+00:00Added an answer on June 9, 2026 at 1:25 am

    around() advice should work:

       Object around() : calculation() {
            long start = System.nanoTime();
            Object result = proceed();
            long end = System.nanoTime();
            logger.info(String.format("%s took %d ns", thisJoinPointStaticPart.getSignature(),
                    (end - start)));
            return result;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a beginner in Java and I have got some problems with the static
Hi I have RMI application and now I try to invoke some methods at
I have Class in java called XMLDOMDocument this class have some methods CreateXML ,
Recently, I have been trying to do some Java work with graphics. Now the
I have some static resources (images and HTML files) that will be localized. One
I have some static text that needs to show up at 2 locations within
I have a base and derived class. The base class constructors have some static
I have some code static void Main(string[] args) { int j = 0; for
I have a windows forms application, where I have declared some static variables. On
I have some TableViewController with static Cells and some TextFields. A few Days ago,

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.