Hi,
my 2 cents here
well, yes you can do it wiht ASpectJ..

But

why would you want to go thru the expensive process of obtaining a reference
of an EJB (i am ASSUMING, reading the code, that since no particular
parameters are passed to  createLocalSearchBORef();the LOcalSearchBORef is
always the same..)  for the sole purpose of removing it at the end of the
method?


hth
marco

On 2/13/07, Rafael Martony <[EMAIL PROTECTED]> wrote:

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.

_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to