[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Applying aspect in Facade EJB
|
Hi everyone, I'm new to aspects and I'm trying to apply this exciting technology in our project.
I have a Facade EJB that contains several methods like these:
public List<XXXX> findXXXX(SearchCriteria searchCriteria, SortCriteria sortCriteria) throws BusinessException, RuleValidationException {
LocalSearchBO localSearchBORef = null;
try {
localSearchBORef = createLocalSearchBORef(); // obtains a local EJB reference
return localSearchBORef.findKeyXXXX(searchCriteria, sortCriteria);
} finally {
removeEJB(localSearchBORef);
}
}
I want to write an aspect to eliminate the need of writing of removeEJB (and the try-finally sentences) on every method.
Is it possible to do that with an aspect?
One possibility is to define localSearchBORef in the class having synchronized access to that field. But I think there's a better solution.
Any help would be appreciated, regards,
Rafael.