当前位置: 首页>>代码示例>>Java>>正文


Java ConfigUtils.isDefault方法代码示例

本文整理汇总了Java中com.alibaba.dubbo.common.utils.ConfigUtils.isDefault方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigUtils.isDefault方法的具体用法?Java ConfigUtils.isDefault怎么用?Java ConfigUtils.isDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.dubbo.common.utils.ConfigUtils的用法示例。


在下文中一共展示了ConfigUtils.isDefault方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: normallizeMock

import com.alibaba.dubbo.common.utils.ConfigUtils; //导入方法依赖的package包/类
private String normallizeMock(String mock) {
	if (mock == null || mock.trim().length() ==0){
		return mock;
	} else if (ConfigUtils.isDefault(mock) || "fail".equalsIgnoreCase(mock.trim()) || "force".equalsIgnoreCase(mock.trim())){
		mock = url.getServiceInterface()+"Mock";
	}
	if (mock.startsWith(Constants.FAIL_PREFIX)) {
        mock = mock.substring(Constants.FAIL_PREFIX.length()).trim();
    } else if (mock.startsWith(Constants.FORCE_PREFIX)) {
        mock = mock.substring(Constants.FORCE_PREFIX.length()).trim();
    }
	return mock;
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:14,代码来源:MockInvoker.java

示例2: normallizeMock

import com.alibaba.dubbo.common.utils.ConfigUtils; //导入方法依赖的package包/类
private String normallizeMock(String mock) {
    if (mock == null || mock.trim().length() == 0) {
        return mock;
    } else if (ConfigUtils.isDefault(mock) || "fail".equalsIgnoreCase(mock.trim()) || "force".equalsIgnoreCase(mock.trim())) {
        mock = url.getServiceInterface() + "Mock";
    }
    if (mock.startsWith(Constants.FAIL_PREFIX)) {
        mock = mock.substring(Constants.FAIL_PREFIX.length()).trim();
    } else if (mock.startsWith(Constants.FORCE_PREFIX)) {
        mock = mock.substring(Constants.FORCE_PREFIX.length()).trim();
    }
    return mock;
}
 
开发者ID:linux-china,项目名称:dubbo3,代码行数:14,代码来源:MockInvoker.java

示例3: normallizeMock

import com.alibaba.dubbo.common.utils.ConfigUtils; //导入方法依赖的package包/类
private String normallizeMock(String mock) {
	if (mock == null || mock.trim().length() ==0){
		return mock;
        //寻找本地Mock类
	} else if (ConfigUtils.isDefault(mock) || "fail".equalsIgnoreCase(mock.trim()) || "force".equalsIgnoreCase(mock.trim())){
		mock = url.getServiceInterface()+"Mock";
	}//mock=fail:throw的时候,返回throw信息
	if (mock.startsWith(Constants.FAIL_PREFIX)) {
        mock = mock.substring(Constants.FAIL_PREFIX.length()).trim();
        //mock=force:XX的时候,返回XX信息
    } else if (mock.startsWith(Constants.FORCE_PREFIX)) {
        mock = mock.substring(Constants.FORCE_PREFIX.length()).trim();
    }
	return mock;
}
 
开发者ID:DoubleSmile,项目名称:dubbo-learning,代码行数:16,代码来源:MockInvoker.java

示例4: normallizeMock

import com.alibaba.dubbo.common.utils.ConfigUtils; //导入方法依赖的package包/类
private String normallizeMock(String mock) {
	if (mock == null || mock.trim().length() == 0) {
		return mock;
	} else if (ConfigUtils.isDefault(mock) || "fail".equalsIgnoreCase(mock.trim())
			|| "force".equalsIgnoreCase(mock.trim())) {
		mock = url.getServiceInterface() + "Mock";
	}
	if (mock.startsWith(Constants.FAIL_PREFIX)) {
		mock = mock.substring(Constants.FAIL_PREFIX.length()).trim();
	} else if (mock.startsWith(Constants.FORCE_PREFIX)) {
		mock = mock.substring(Constants.FORCE_PREFIX.length()).trim();
	}
	return mock;
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:15,代码来源:MockInvoker.java

示例5: invoke

import com.alibaba.dubbo.common.utils.ConfigUtils; //导入方法依赖的package包/类
public Result invoke(Invoker<?> invoker, Invocation inv) throws RpcException {
    try {
        String accesslog = invoker.getUrl().getParameter(Constants.ACCESS_LOG_KEY);
        if (ConfigUtils.isNotEmpty(accesslog)) {
            RpcContext context = RpcContext.getContext();
            String serviceName = invoker.getInterface().getName();
            String version = invoker.getUrl().getParameter(Constants.VERSION_KEY);
            String group = invoker.getUrl().getParameter(Constants.GROUP_KEY);
            StringBuilder sn = new StringBuilder();
            sn.append("[").append(new SimpleDateFormat(MESSAGE_DATE_FORMAT).format(new Date())).append("] ").append(context.getRemoteHost()).append(":").append(context.getRemotePort())
            .append(" -> ").append(context.getLocalHost()).append(":").append(context.getLocalPort())
            .append(" - ");
            if (null != group && group.length() > 0) {
                sn.append(group).append("/");
            }
            sn.append(serviceName);
            if (null != version && version.length() > 0) {
                sn.append(":").append(version);
            }
            sn.append(" ");
            sn.append(inv.getMethodName());
            sn.append("(");
            Class<?>[] types = inv.getParameterTypes();
            if (types != null && types.length > 0) {
                boolean first = true;
                for (Class<?> type : types) {
                    if (first) {
                        first = false;
                    } else {
                        sn.append(",");
                    }
                    sn.append(type.getName());
                }
            }
            sn.append(") ");
            Object[] args = inv.getArguments();
            if (args != null && args.length > 0) {
                sn.append(JSON.json(args));
            }
            String msg = sn.toString();
            if (ConfigUtils.isDefault(accesslog)) {
                LoggerFactory.getLogger(ACCESS_LOG_KEY + "." + invoker.getInterface().getName()).info(msg);
            } else {
                log(accesslog, msg);
            }
        }
    } catch (Throwable t) {
        logger.warn("Exception in AcessLogFilter of service(" + invoker + " -> " + inv + ")", t);
    }
    return invoker.invoke(inv);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:52,代码来源:AccessLogFilter.java

示例6: invoke

import com.alibaba.dubbo.common.utils.ConfigUtils; //导入方法依赖的package包/类
public Result invoke(Invoker<?> invoker, Invocation inv) throws RpcException {
    try {
        String accesslog = invoker.getUrl().getParameter(Constants.ACCESS_LOG_KEY);
        if (ConfigUtils.isNotEmpty(accesslog)) {
            RpcContext context = RpcContext.getContext();
            String serviceName = invoker.getInterface().getName();
            String version = invoker.getUrl().getParameter(Constants.VERSION_KEY);
            String group = invoker.getUrl().getParameter(Constants.GROUP_KEY);
            StringBuilder sn = new StringBuilder();
            sn.append("[").append(new SimpleDateFormat(MESSAGE_DATE_FORMAT).format(new Date())).append("] ").append(context.getRemoteHost()).append(":").append(context.getRemotePort())
            .append(" -> ").append(context.getLocalHost()).append(":").append(context.getLocalPort())
            .append(" - ");
            if (null != group && group.length() > 0) {
                sn.append(group).append("/");
            }
            sn.append(serviceName);
            if (null != version && version.length() > 0) {
                sn.append(":").append(version);
            }
            sn.append(" ");
            sn.append(inv.getMethodName());
            sn.append("(");
            Class<?>[] types = inv.getParameterTypes();
            if (types != null && types.length > 0) {
                boolean first = true;
                for (Class<?> type : types) {
                    if (first) {
                        first = false;
                    } else {
                        sn.append(",");
                    }
                    sn.append(type.getName());
                }
            }
            sn.append(") ");
            Object[] args = inv.getArguments();
            if (args != null && args.length > 0) {
                sn.append(JSON.json(args));
            }
            String msg = sn.toString();
            //如果只是简单配置accesslog为true的话表示只会通过dubbo内部的logger打印accesslog,但是不会持久化存储
            if (ConfigUtils.isDefault(accesslog)) {
                LoggerFactory.getLogger(ACCESS_LOG_KEY + "." + invoker.getInterface().getName()).info(msg);
            } else {
                log(accesslog, msg);
            }
        }
    } catch (Throwable t) {
        logger.warn("Exception in AcessLogFilter of service(" + invoker + " -> " + inv + ")", t);
    }
    return invoker.invoke(inv);
}
 
开发者ID:DoubleSmile,项目名称:dubbo-learning,代码行数:53,代码来源:AccessLogFilter.java

示例7: invoke

import com.alibaba.dubbo.common.utils.ConfigUtils; //导入方法依赖的package包/类
public Result invoke(Invoker<?> invoker, Invocation inv) throws JahhanException {
    try {
        String accesslog = invoker.getUrl().getParameter(Constants.ACCESS_LOG_KEY);
        if (ConfigUtils.isNotEmpty(accesslog)) {
            RpcContext context = RpcContext.getContext();
            String serviceName = invoker.getInterface().getName();
            String version = invoker.getUrl().getParameter(Constants.VERSION_KEY);
            String group = invoker.getUrl().getParameter(Constants.GROUP_KEY);
            StringBuilder sn = new StringBuilder();
            sn.append("[").append(new SimpleDateFormat(MESSAGE_DATE_FORMAT).format(new Date())).append("] ").append(context.getRemoteHost()).append(":").append(context.getRemotePort())
            .append(" -> ").append(context.getLocalHost()).append(":").append(context.getLocalPort())
            .append(" - ");
            if (null != group && group.length() > 0) {
                sn.append(group).append("/");
            }
            sn.append(serviceName);
            if (null != version && version.length() > 0) {
                sn.append(":").append(version);
            }
            sn.append(" ");
            sn.append(inv.getMethodName());
            sn.append("(");
            Class<?>[] types = inv.getParameterTypes();
            if (types != null && types.length > 0) {
                boolean first = true;
                for (Class<?> type : types) {
                    if (first) {
                        first = false;
                    } else {
                        sn.append(",");
                    }
                    sn.append(type.getName());
                }
            }
            sn.append(") ");
            Object[] args = inv.getArguments();
            if (args != null && args.length > 0) {
                sn.append(JSON.json(args));
            }
            String msg = sn.toString();
            if (ConfigUtils.isDefault(accesslog)) {
                log.info(msg);
            } else {
                log(accesslog, msg);
            }
        }
    } catch (Throwable t) {
        log.warn("Exception in AcessLogFilter of service(" + invoker + " -> " + inv + ")", t);
    }
    return invoker.invoke(inv);
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:52,代码来源:AccessLogFilter.java


注:本文中的com.alibaba.dubbo.common.utils.ConfigUtils.isDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。