Eric Bodden
2005-06-02 14:18:39 UTC
Hi.
I have been wondering if anyone here knows how to properly capture
the shutdown of a Java application.
I have been using the following:
pointcut appExit():
execution(public static void *.main(..)) &&
!cflowbelow(execution(public static void main(String[])));
This matches the execution of the outermost "main" method. With an
"after returning"-advice I wanted to capture the shutdown. However,
this does not work if "main" spawns another thread. Then the control
flow in "main" might reach the end of the method and thus trigger the
advice while another thread is still active. So I have to take care
of the threads somehow. Has anybody done something like this yet?
Cheers,
Eric
I have been wondering if anyone here knows how to properly capture
the shutdown of a Java application.
I have been using the following:
pointcut appExit():
execution(public static void *.main(..)) &&
!cflowbelow(execution(public static void main(String[])));
This matches the execution of the outermost "main" method. With an
"after returning"-advice I wanted to capture the shutdown. However,
this does not work if "main" spawns another thread. Then the control
flow in "main" might reach the end of the method and thus trigger the
advice while another thread is still active. So I have to take care
of the threads somehow. Has anybody done something like this yet?
Cheers,
Eric