I get the error that "call" pointcut isn't supported by Spring anymore. I just have this aspects configuration file [1] in the `resources` dir. The structure of my project is in [2].

Is there an alternative for "call"? I don't know AspectJ, just Spring-Aop.

If I implement my OutputCollector file, can I use `execution` call?



[1] bean-aspects.xml

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:p="http://www.springframework.org/schema/p"; xmlns:aop="http://www.springframework.org/schema/aop"; xmlns:context="http://www.springframework.org/schema/context"; xmlns:jee="http://www.springframework.org/schema/jee"; xmlns:tx="http://www.springframework.org/schema/tx"; xmlns:task="http://www.springframework.org/schema/task"; xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd";>

    <aop:aspectj-autoproxy proxy-target-class="true">
        <aop:include name="mapreduceAspect"/>
    </aop:aspectj-autoproxy>
    <context:load-time-weaver/>
    <context:component-scan base-package="org.apache.hadoop.mapred"/>

<bean id="mapreduceAspect" class="org.apache.hadoop.mapred.aspects.MapReduceAspects"/>
</beans>


[2] Structure of my project
medusa-java$ tree
.
├── medusa-java.iml
├── pom.xml
├── src
│   ├── main
│   │   ├── java
│   │   │   └── org
│   │   │       └── apache
│   │   │           └── hadoop
│   │   │               └── mapred
│   │   │                   ├── aspects
│   │   │                   │   └── MapReduceAspects.java
│   │   │                   ├── (java files)
│   │   │                   ├── examples
│   │   │                   │   ├── (java files)
│   │   │                   ├── (java files)
│   │   ├── main.iml
│   │   └── resources
│   │       └── bean-aspects.xml
│   └── test (unit tests)
│       └── test.iml
├── target
│   ├── classes
│   │   ├── aop.xml
│   │   ├── bean-aspects.xml
│   │   ├── builddef.lst
│   │   └── org
│   │       └── apache
│   │           └── hadoop
│   │               └── mapred
│   │                   ├── aspects
│   │                   │   ├── MapReduceAspects.class
│   │                   │   └── MedusaDigestsAspects.class
│   │                   ├── examples (class files)
│   │                   ├── (class files)
│   ├── dependency-jars (jar files)
│   ├── generated-sources
│   │   ├── annotations
│   │   └── test-annotations
│   ├── generated-test-sources
│   │   └── test-annotations
│   ├── maven-archiver
│   │   └── pom.properties
│   ├── maven-status
│   │   └── maven-compiler-plugin
│   │       ├── compile
│   │       │   └── default-compile
│   │       │       ├── createdFiles.lst
│   │       │       └── inputFiles.lst
│   │       └── testCompile
│   │           └── default-testCompile
│   │               ├── createdFiles.lst
│   │               └── inputFiles.lst
│   ├── medusa-java.jar
│   └── test-classes
│       └── org
│           └── apache
│               └── hadoop
│                   └── mapred
│                       └── examples (class files)



On 09/09/2015 02:26 PM, Frank Pavageau wrote:
Hi.

2015-09-09 12:04 GMT+02:00 xeonmailinglist <[email protected] <mailto:[email protected]>>:

    [2] My mapreduce aspects

    |package org.apache.hadoop.mapred.aspects; import
    org.aspectj.lang.JoinPoint; import
    org.aspectj.lang.annotation.Aspect; import
    org.aspectj.lang.annotation.Before; @Aspect public class
    MapReduceAspects { @Before("execution(* map(..))") public void
    mymap(JoinPoint joinPoint) { System.out.println("My Map Execution:
    " + joinPoint.getArgs() + ":" + joinPoint.getTarget()); Object[]
    obj = joinPoint.getArgs(); for (Object o : obj){
    System.out.println(o.toString()); } } @Before("execution(*
    reduce(..))") public void myreduce() { System.out.println("My
    Reduce Execution"); } @Before("execution(* collect(..))") public
    void updatehash(JoinPoint joinPoint) { System.out.println("Output
    collect: Args: " + joinPoint.getArgs()); } } |

 [...]

    I can intercept the |map| and |reduce| function calls with
    AspectJ, but I can’t intercept the |collect| call in the
    instruction |output.collect(word, one)| that is in the |map|
    function. Why this happens? Didn`t I configure the Aspects correctly?

No, actually, you're not intercepting the *calls* (at the call site), but the *executions* (in the implementing class), as noted in your pointcuts. Which is why you can't intercept collect(): it's not implemented by any of your classes, and you're not weaving the Hadoop classes themselves.

You can intercept the call, by changing the pointcut from execution(...) to call(...), though you probably want to qualify the method with the type to avoid intercepting other calls to methods with the same (generic) name:
  call(* org.apache.hadoop.mapred.OutputCollector+.collect(..))

Regards,
Frank


_______________________________________________
aspectj-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to