[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[aspectj-users] Accessing the target from within @Around
|
- From: Norman Elton <normelton@xxxxxxxxx>
- Date: Wed, 19 Aug 2009 18:09:32 -0400
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=Sp1wu+9uDhVMxbrfdn4JAI7RhQRo3fb7QH1juch4gmg=; b=vokIyhvEog8wQWd6mhcsO3Jg4esOJ6PHrAfLkTdLo8alhzWYsBw4+J3FocQLOPCJVc owsvfKB0t0q3w7+jGyjMJvLN/CY1flsoKUuPHX7J4MZeOrC87Tq2yEh5Ib2AcALHruU6 qJ4oRCRcQjHzMay6ye3DIMmi4T9tcNHca8pko=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=VJguWQh20bMldTyvEbN0Vqzh2eamCBUKKNODcVRjnm5WjvCJ5F1erswoYIAdBRdpak 79Z+l9TLSH+Xs0T2EYB1uCAKTUAzYyYUT6pmqXsYWEYcckaQT32WptXLd0gCLi4GPO9O ONGbla8YJTuJ8Os2NI4D57XptC3tAoc3HYLzI=
Suppose I've got the following simple wrapper around a Job's run() method:
@Aspect
public class JobWrapperAspect {
@Around("execution(void com.example.jobs.FooJob.run())")
public void retryJob(ProceedingJoinPoint join_point) throws Throwable {
System.out.println("About to run a FooJob");
join_point.proceed();
System.out.println("Done running a FooJob");
}
}
That's pretty straightforward, and works well.
But is there any way to access the job object from within my advice?
Something like...
System.out.println("About to run a " + job.toString());
join_point.proceed();
System.out.println("Done running a " + job.toString());
Any ideas? How do I access the "job" object?
Thanks!
Norman