Hi Marco, thank you for your answer.
createLocalSearchBORef() obtains a reference to a local EJB, and I'm
assuming it is not always the same ref (since the app server takes ejb's
from its pool) in every method call.

So, the findXXXX method obtains a reference to an local EJB, makes a call to
a method of that EJB, and  then destroys it.

I tried writing an aspect using @AspectJ style without success.

Re


On 2/13/07, Marco Mistroni < [EMAIL PROTECTED]> wrote:

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


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

Reply via email to