Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Clarification of concrete aspect implementation whether it is SINGLETON

Should just be perclause=“”

<concrete-aspect name=“main.java.aop.field.MyFieldAspect” perclause=“pertypewithin(Foo)">
  <around pointcut="get(@main.java.aop.field.Field * *)" invokeClass="main.java.aop.field.FieldAspect" invokeMethod="getField()”/>
</concrete-aspect>

But I’ll admit I have no AspectJ test cases that use the non extending form of the concrete-aspect with a perclause. All my test cases use the extending form:

    <concrete-aspect name="SubAspect" extends="Base2" perclause="pertypewithin(*)">
      <pointcut name="scope" _expression_="within(D*)"/>
    </concrete-aspect>

That doesn’t mean it won’t work, it just means it isn’t reliably tested.

Andy

On Jun 5, 2015, at 2:42 AM, sridhar thiyagarajan <sridharthiyagarajan@xxxxxxxxx> wrote:

Many thanks for the response .. Andy. I learnt that following are the different types of associations possible in aspectj.

  • Singleton (default)
  • Per object
  • Per control-flow
  • Per type

Below shows the syntax about how to use the association when defined in aspect.

aspect <AspectName> [<perthis|pertarget|percflow|percflowbelow>(<Pointcut>)] {
    ... aspect body
}

I have defined all aspects in the configuration aop.xml like below as load time weaving and configurable pointcuts are needed.

<concrete-aspect name="main.java.aop.field.MyFieldAspect">
    <around pointcut="get(@main.java.aop.
field.Field * *)" invokeClass="main.java.aop.field.FieldAspect" invokeMethod="getField()"/>
  </concrete-aspect>

Can you please help me about how should I define a "Per object" aspect association to the above concrete aspect definition in an XML.

Many thanks.

Sridhar Thiyagarajan

On Wed, Jun 3, 2015 at 11:38 PM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
I’m not sure you can control the creation of the aspect object instance. If it isn’t covered in the docs ( https://eclipse.org/aspectj/doc/released/devguide/ltw-configuration.html#concrete-aspect )  or the readme describing this extension ( https://eclipse.org/aspectj/doc/released/README-1612.html ) then I don’t think it is supported. You could raise an enhancement request or if you post your use case here there may be alternative ways to achieve it.

cheers,
Andy

On Jun 3, 2015, at 8:42 AM, sridhar thiyagarajan <sridharthiyagarajan@xxxxxxxxx> wrote:

Many thanks for the response .. Andy. Could you please help me about the attribute to be added in the below concrete aspect definition that controls the object creation and the possible values for it.


  <concrete-aspect name="main.java.aop.field.
MyFieldAspect">
    <around pointcut="get(@main.java.aop.
field.Field * *)" invokeClass="main.java.aop.field.FieldAspect" invokeMethod="getField()"/>
  </concrete-aspect>


Thanks.
Sridhar Thiyagarajan


On Tue, Jun 2, 2015 at 11:21 PM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
Yep, if you don’t specify then it is singleton.

cheers,
Andy

On Jun 2, 2015, at 12:21 AM, sridhar thiyagarajan <sridharthiyagarajan@xxxxxxxxx> wrote:

Hello,

I am using concrete aspects in my project. Could anyone please help me to understand whether the implementation objects of concrete aspects defined in the below aop.xml are singleton.

Please confirm my understanding that there will be only one instance of concrete-aspect implementation created for each concrete aspect definition in the aop.xml generated by the aspectJ. JFYI that load time weaving is employed in my project.


<?xml version="1.0" encoding="UTF-8"?>
<aspectj>
<aspects>

  <concrete-aspect name="main.java.aop.field.
MyFieldAspect">
    <around pointcut="get(@main.java.aop.
field.Field * *)" invokeClass="main.java.aop.field.FieldAspect" invokeMethod="getField()"/>
  </concrete-aspect>

  <concrete-aspect name="main.java.aop.extend.
ConcreteTracingImpl">
    <around pointcut="execution(@main.
java.aop.method.Method * *(..))" invokeClass="main.java.aop.extend.AbstractTracing" invokeMethod="traceMethod()"/>
  </concrete-aspect>

</aspects>

<weaver options="-verbose -showWeaveInfo" />
</aspectj>


Thanks.

Sridhar Thiyagarajan
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-dev


_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-dev


_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-dev

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-dev


Back to the top