Le 28/02/2012 07:05, Hemal Pandya a écrit :
I am trying to develop
a development framework where we can introduce a delay at
arbitrary but simple join-points. This is intended for some
testing related to concurrency and such-like.
What I want to be able to do is, on different runs specify a
method before or after execution of which the thread should
pause. For any run, I don't expect the total pauses to be more
then 10, if that many.
I can think of two ways to do this and would appreciate very
much any views on their pros and cons.
One approach is to define two abstract aspects, PauseBefore and
PauseAfter. In aop.xml concrete aspects are defined that extend
one of the two. The other approach is to have single Pause
aspect that reads an external file that lists the method names
and before/after labels.
The biggest problem with the abstract aspect approach is writing
the aop.xml. The runs will likely be done by others with no
experience with AspectJ or even programming, and I will need to
build some kind of tool that creates the aop.xml file and
packages it correctly in a jar.
With a single aspect I guess every method will have to be
instrumented , which will that be too much of an overhead? If
that can be compensated somehow, I can think of many advantages,
such as changing the configuration on the fly without restarting
the process, specifying the wait time.
There must be middle-road that is the best approach, but I am
not able to see it. Any advice?
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
yes it is possible to package it, with the package java.util.jar in
java SE
At work,I have done a AspectJ packager for LTW weaving for tracing
in logs files or exposing values as MBeans attributes.
The packager gui is java Swing. But what is not evident for
beginner, in abstract aspect, is to write a correct pointcut. In
your case it is certainly simple ( the full name of the method,
giving a pattern may help the users)
|