Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] How to write pointcut

I’m writing an aspect to major a performance of a stored-procedure call.  I would like my aspect to get called when the method has “Profiling” aspect.  I tried various approach but it can’t seem to make it work. 

 

Here is the snippet of code:

 

public class JDBCProfilingAspect {

 

            @Profiling 

            public void makeProfileDataBaseCall() {

 

                        .............

                CallableStatement statement = connection.prepareCall("{ call PACKAGE.PROCEDURE(?) }");

                statement.execute();

                        ........................

            }

 

            public void makeDataBaseCall() {

 

                        .............

                CallableStatement statement = connection.prepareCall("{ call PACKAGE.PROCEDURE(?) }");

                statement.execute();

                        ........................

            }

 

}

 

// Doesn’t work

@Pointcut("call(* java.sql.Statement+.execute*(..)) && @within(@com.xyz.Profiling * *(..)) ")

public void profileJDBCExecute() {

}

 

// Doesn’t work

@Pointcut("call(* java.sql.Statement+.execute*(..)) && @annotation(com.xyz.Profiling * *(..)) ")

public void profileJDBCExecute() {

}

 

 

DP.


Back to the top