Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] LTW:Synchronizing a non synchronized method

Me again ... 
Perhaps a better pattern ?  All the code of the around advice is
synchronized

What is the better/correct monitor ( this => the aspect or
thisJoinPoint.getThis() => the woven class) ?

public aspect MySynchronizor {
 
    public  pointcut methods(): execution( public *
*..<class>.<methodToSynchronize>(..));

    Object around(): methods() {
	synchronized(this){  // or synchronized(thisJoinPoint.getThis()) ?)
  		Object retour = null;
		retour = proceed();
		... Some stuff after  proceed
		return retour
		}
	}
 }

Cordialement / Best regards

Jean-Louis Pasturel

-----Message d'origine-----
De : aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] De la part de
jeanlouis.pasturel@xxxxxxxxxx
Envoyé : mardi 4 septembre 2012 08:22
À : aspectj-users@xxxxxxxxxxx
Objet : [aspectj-users] LTW:Synchronizing a non synchronized method

 
To synchronize a not synchronized method, does this Aspect do correctly the
job ?
 
public aspect MySynchronizor {
 
    public  pointcut methods(): execution( public *
*..<class>.<methodToSynchronize>(..));

    Object around(): methods() {
  	Object retour = null;
	synchronized(this){
		retour = proceed();
		}
	... Some stuff after the proceed
	return retour
	}
 }

Cordialement / Best regards

Jean-Louis Pasturel





____________________________________________________________________________
_____________________________________________

Ce message et ses pieces jointes peuvent contenir des informations
confidentielles ou privilegiees et ne doivent donc pas etre diffuses,
exploites ou copies sans autorisation. Si vous avez recu ce message par
erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les
pieces jointes. Les messages electroniques etant susceptibles d'alteration,
France Telecom - Orange decline toute responsabilite si ce message a ete
altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged
information that may be protected by law; they should not be distributed,
used or copied without authorisation.
If you have received this email in error, please notify the sender and
delete this message and its attachments.
As emails may be altered, France Telecom - Orange is not liable for messages
that have been modified, changed or falsified.
Thank you.

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



_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
France Telecom - Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, France Telecom - Orange is not liable for messages that have been modified, changed or falsified.
Thank you.



Back to the top