
com.nh.micro.template.GroovyDbAopImpl Maven / Gradle / Ivy
package com.nh.micro.template;
import java.lang.reflect.Method;
import groovy.lang.GroovyObject;
import com.nh.micro.db.GroovyDbSwitcher;
import com.nh.micro.db.GroovyDataSource;
import com.nh.micro.rule.engine.core.GroovyAopInter;
/**
*
* @author ninghao
*
*/
public class GroovyDbAopImpl extends GroovyAopInter {
public static ThreadLocal countCall=new ThreadLocal();
public static void addCountCall(){
Integer count=countCall.get();
if(count==null){
count=new Integer(0);
}
count=count+1;
countCall.set(count);
}
public static void subAndRemoveCountCall(){
Integer count=countCall.get();
if(count==null){
return;
}
count=count-1;
countCall.set(count);
if(count<=0){
GroovyDbSwitcher.removeLocal();
}
}
@Override
public Object invokeMethod(GroovyObject groovyObject, String GroovyName,
String methodName, Object... param) {
Class[] paramTypeArray=null;
if(param!=null){
int size=param.length;
paramTypeArray=new Class[size];
for(int i=0;i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy