Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] pointcut before thread exits

Hello,

I need to get the time in which every program's thread exits. The code I am
profiling looks like this:

public class Phil implements Runnable {
	   Phil() {	// constructor	      
	      new Thread(this, "Phil").start();	// make a new thread and start it
	   }

	   public void run() {			// must override run, this is what
	      for(int i=0; i<2;) {		// is executed when the thread starts running
                   if(<TEST SOMETHING>)
                      i++;
                   Thread.sleep(500);
	      }
	   }

Anyway, the idea is to have a profiler that would trace any code, so the
solution has to be general.

my try has been:

public final pointcut allThreadRun(Thread t) : (execution(void run()) &&
this(t) && !within(ProfilerAspect);

after(Thread t) : allThreadRun(t) //!the advice doesn't match anything, the
following code never executes
{
    threadStopHash.put(t,System.currentTimeMillis());
}

Any info will be appreciated.

Thanks!

Hector.
-- 
View this message in context: http://aspectj.2085585.n4.nabble.com/pointcut-before-thread-exits-tp3030282p3030282.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


Back to the top