[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [aspectj-users] Pointcut scoped variables
|
- From: "Eric Bodden" <eric.bodden@xxxxxxxxxxxxxx>
- Date: Wed, 2 Jul 2008 16:32:56 -0400
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=1RfzL+rrZ+7iX+di6a/YviyYNGN/3k+Fb2Tv2l8zTJ0=; b=ZDhu2lA9IKl5eDhi0FYtvYjcgFk36GaurPnyPOEhvz5SBYgoFUyrHJJnHz8cDJ09Og p9wQRAw2XfL3atND38z8s+x2dLHGygGQ9yZsf8TKDQL47ap1WYcTB/ZfpZ9m3Ys6JN3i Y9LdP3T1n1k+XFK4Um6AXIlK4HU3+faqyOIeo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=nrQfyYx2E5knRZgOI4bCqvcMjEEw0WzID+wQdDVLzOSeXKdXfSKQpztVfAnDCszo8m tdzlxQzt6FhTHcvxilSchzZSGEzBDDq0HIDELNJANk+3MAPk7e7jwXwpeHqNyrR9l74Q cZEJQz4HDUg4uUbFflvMiq1cXX+ODH3Lle7bw=
Hi. I think you may want to use an around advice.
Eric
2008/7/2 jbx <josef.bajada@xxxxxxxxx>:
>
> Is there a way to have "point-cut joinpoint scoped" variables shared across
> @Before advices and @After advices (for the same joinpoint instance)?
>
> Consider the following simple example, just to illustrate the case. Imagine
> it is running in a multi-threading application:
>
> public void doTask(TheTask task)
> {
> //these two lines should be in a separate aspect @Before the pointcut for
> this method
> String oldname = Thread.currentThread().getName();
> Thread.currentThread().setName(task.getName());
>
> try
> {
> //do the actual task
> task.execute();
> }
> finally
> {
> //the following should be in a separate aspect @After the pointcut
> for this method
> Thread.currentThread().setName(oldname);
> }
> }
>
>
> How do I carry the oldname variable for the same joinpoint, from one advice
> to another (in the same pointcut scope), if at all possible?
>
> Thanks.
> --
> View this message in context: http://www.nabble.com/Pointcut-scoped-variables-tp18240663p18240663.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
--
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada