Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] avoid locked method invocation with an annotation

 Are you sure you can use proceed method with a before advice? I think you
can use it only with around advice.


Cordialement / Best regards

Jean-Louis Pasturel



-----Message d'origine-----
De : aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] De la part de Luca Ferrari
Envoyé : lundi 15 février 2010 08:36
À : aspectj-users@xxxxxxxxxxx
Objet : [aspectj-users] avoid locked method invocation with an annotation

Hi all,
as by subject I'd like to annotate some methods with a @Lock annotation and
I'd like to have an aspect avoiding the invocation of such methods, so I
have done the following:

    private pointcut avoidLockedMethodInvocation( AgentProxy proxy ) : 
       call( public AgentProxy+.*(..) )  && 	@annotation(Lock) 	
           && target( proxy );
    
    
    before( AgentProxy proxy ) : avoidLockedMethodInvocation( proxy ){
	
	if( isAgentProxyLocked( proxy ) )
	    throw new Exception();
	else
	    proceed( proxy );
    }


But it gives me a "formal unbound" error on the proxy parameter. Moreover
I'm in doubt if it is correct to use the annotation pointcut in such a way.
What I want to avoid is that a method like the following is invoked:

public class myproxy extends AgentProxy{
    @Lock()
   public void method(){}
}

Anybody can give me some hint?

Thanks,
Luca
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



*********************************
This message and any attachments (the "message") are confidential and intended solely for the addressees. 
Any unauthorised use or dissemination is prohibited.
Messages are susceptible to alteration. 
France Telecom Group shall not be liable for the message if altered, changed or falsified.
If you are not the intended addressee of this message, please cancel it immediately and inform the sender.
********************************



Back to the top