Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aspect Oriented Programming- advice runs in same thread?

Tags:

spring-aop

If I have an advice(before, after or around) which will be applicable to a method, will this advice run in the same thread which invokes the method? This is Spring's AOP.

like image 607
Achow Avatar asked Jan 08 '13 03:01

Achow


People also ask

Which of the following is true about AOP advice?

An around advice is a special advice that can control when and if a method (or other join point) is executed. This is true for around advices only, so they require an argument of type ProceedingJoinPoint, whereas other advices just use a plain JoinPoint.

Which of the following is advice supported by aspect annotation Mcq?

Which of the following is advice supported by Aspect Annotation? Explanation: AspectJ supports five types of advice annotations: @Before, @After, @AfterReturning, @AfterThrowing, and @Around. 3.

Which of the following is true about after advice in Spring AOP?

After throwing advice runs when a matched method execution exits by throwing an exception. It is declared using the @AfterThrowing annotation: import org. aspectj.

What is aspect in Aspect-Oriented Programming?

Aspect: The class which implements the JEE application cross-cutting concerns(transaction, logger etc) is known as the aspect. It can be normal class configured through XML configuration or through regular classes annotated with @Aspect. Weaving: The process of linking Aspects with an Advised Object.


1 Answers

Yes, it will run in the same thread. The Aspect will create a proxy of the object method which matches the pointcut definition which will be executed around the method. But it does not do anything on a different thread.

like image 70
EdH Avatar answered Sep 21 '22 19:09

EdH