public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Compensable compensable = method.getAnnotation(Compensable.class); if (compensable != null) { if (StringUtils.isEmpty(compensable.confirmMethod())) { ReflectionUtils.changeAnnotationValue(compensable, "confirmMethod", method.getName()); ReflectionUtils.changeAnnotationValue(compensable, "cancelMethod", method.getName()); ReflectionUtils.changeAnnotationValue(compensable, "transactionContextEditor", DubboTransactionContextEditor.class); ReflectionUtils.changeAnnotationValue(compensable, "propagation", Propagation.SUPPORTS); } ProceedingJoinPoint pjp = new MethodProceedingJoinPoint(proxy, target, method, args); return FactoryBuilder.factoryOf(ResourceCoordinatorAspect.class).getInstance().interceptTransactionContextMethod(pjp); } else { return super.invoke(target, method, args); } }
public void addMethod(String methodCode){ if(mMethods==null){ mMethods = new ArrayList<String>(); } if(!StringUtils.isEmpty(methodCode)){ mMethods.add(methodCode); } }
public void addField(String fieldCode){ if(mFields==null){ mFields = new ArrayList<String>(); } if(!StringUtils.isEmpty(fieldCode)){ mFields.add(fieldCode); } }
public void addInterface(String interfaceName){ if(mInterfaces ==null){ mInterfaces = new ArrayList<String>(); } if(!StringUtils.isEmpty(interfaceName)){ mInterfaces.add(interfaceName); } }
public void addInterface(String interfaceName){ if(mInterfaces ==null){ mInterfaces = new ArrayList<String>(); } if(!StringUtils.isEmpty(interfaceName)){ mInterfaces.add(interfaceName); } }
public void setGeneric(String generic) { if (StringUtils.isEmpty(generic)) { return; } if (ProtocolUtils.isGeneric(generic)) { this.generic = generic; } else { throw new IllegalArgumentException("Unsupported generic type " + generic); } }
public static double getProperty(String key,double defaultValue){ String value = getProperty(key); if(!StringUtils.isEmpty(value)){ return Double.parseDouble(value); } return defaultValue; }
public static short getProperty(String key,short defaultValue){ String value = getProperty(key); if(!StringUtils.isEmpty(value)){ return Short.parseShort(value); } return defaultValue; } public static long getProperty(String key,long defaultValue){
public static float getProperty(String key,float defaultValue){ String value = getProperty(key); if(!StringUtils.isEmpty(value)){ return Float.parseFloat(value); } return defaultValue; } public static double getProperty(String key,double defaultValue){
public static String getProperty(String key,String defaultValue){ String value = getProperty(key); if(!StringUtils.isEmpty(value)){ return value; } return defaultValue; }
public static short getProperty(String key,short defaultValue){ String value = getProperty(key); if(!StringUtils.isEmpty(value)){ return Short.parseShort(value); } return defaultValue; } public static long getProperty(String key,long defaultValue){
public static int getProperty(String key,int defaultValue){ String value = getProperty(key); if(!StringUtils.isEmpty(value)){ return Integer.parseInt(value); } return defaultValue; } public static short getProperty(String key,short defaultValue){
public static String getProperty(String key,String defaultValue){ String value = getProperty(key); if(!StringUtils.isEmpty(value)){ return value; } return defaultValue; }
public static int getProperty(String key,int defaultValue){ String value = getProperty(key); if(!StringUtils.isEmpty(value)){ return Integer.parseInt(value); } return defaultValue; } public static short getProperty(String key,short defaultValue){
public static double getProperty(String key,double defaultValue){ String value = getProperty(key); if(!StringUtils.isEmpty(value)){ return Double.parseDouble(value); } return defaultValue; }
protected void loadProviders(String value) { for (String clazz : Constants.COMMA_SPLIT_PATTERN.split(value)) { if (!StringUtils.isEmpty(clazz)) { getDeployment().getProviderClasses().add(clazz.trim()); } } }
protected void loadProviders(String value) { for (String clazz : Constants.COMMA_SPLIT_PATTERN.split(value)) { if (!StringUtils.isEmpty(clazz)) { getDeployment().getProviderClasses().add(clazz.trim()); } } }
public AbstractCache(String cacheName,URL url){ if(StringUtils.isEmpty(cacheName)){ cacheName="noarguments"; } this.cacheName =objectToBytes(url,cacheName); cachedUrl=url; expireSecond=getExpireSecond(url); }
public AbstractCache(String cacheName,URL url){ if(StringUtils.isEmpty(cacheName)){ cacheName="noarguments"; } this.cacheName =objectToBytes(url,cacheName); cachedUrl=url; expireSecond=getExpireSecond(url); }
private static Class<? extends InvokeHandler> getInvokeHandler(Class<?> clientType,String id){ //dubbo.wrapper.[clientfacadefullname].handler String handlerName = ConfigUtils.getProperty(DUBBO_WRAPPER_KEY_PREFIX + id + INVOKE_HANDLER_KEY_SUFFIX); if(StringUtils.isEmpty(handlerName)){ return DEFAULT_HANDLER; } return generateHandler(handlerName); }