posted 10 years ago
Spring AOP definitely is a good solution for this pattern.
You need to use the 'around' type of advice, or a combination of the other advices.
The 'around' type is probably the best for this case, as it looks like you will do monitoring most likely: after an execution, or when an exception is thrown, or, break the circuit before an execution, if the condition is met.
The condition will depend on a 'state'. You will therefore need the advice bean to be stateful, otherwise you will need a way to keep the state somewhere. An example of the 'state' is a count of how many failures has there been.
- j