本文整理汇总了Java中com.alibaba.dubbo.common.utils.ConfigUtils类的典型用法代码示例。如果您正苦于以下问题:Java ConfigUtils类的具体用法?Java ConfigUtils怎么用?Java ConfigUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigUtils类属于com.alibaba.dubbo.common.utils包,在下文中一共展示了ConfigUtils类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: invoke
import com.alibaba.dubbo.common.utils.ConfigUtils; //导入依赖的package包/类
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
if (validation != null && ! invocation.getMethodName().startsWith("$")
&& ConfigUtils.isNotEmpty(invoker.getUrl().getMethodParameter(invocation.getMethodName(), Constants.VALIDATION_KEY))) {
try {
Validator validator = validation.getValidator(invoker.getUrl());
if (validator != null) {
validator.validate(invocation.getMethodName(), invocation.getParameterTypes(), invocation.getArguments());
}
} catch (RpcException e) {
throw e;
} catch (Throwable t) {
throw new RpcException(t.getMessage(), t);
}
}
return invoker.invoke(invocation);
}
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:17,代码来源:ValidationFilter.java
示例2: invoke
import com.alibaba.dubbo.common.utils.ConfigUtils; //导入依赖的package包/类
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
if (cacheFactory != null && ConfigUtils.isNotEmpty(invoker.getUrl().getMethodParameter(invocation.getMethodName(), Constants.CACHE_KEY))) {
Cache cache = cacheFactory.getCache(invoker.getUrl().addParameter(Constants.METHOD_KEY, invocation.getMethodName()));
if (cache != null) {
String key = StringUtils.toArgumentString(invocation.getArguments());
if (cache != null && key != null) {
Object value = cache.get(key);
if (value != null) {
return new RpcResult(value);
}
Result result = invoker.invoke(invocation);
if (! result.hasException()) {
cache.put(key, result.getValue());
}
return result;
}
}
}
return invoker.invoke(invocation);
}
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:21,代码来源:CacheFilter.java
示例3: isActive
import com.alibaba.dubbo.common.utils.ConfigUtils; //导入依赖的package包/类
private boolean isActive(Activate activate, URL url) {
String[] keys = activate.value();
if (keys == null || keys.length == 0) {
return true;
}
for (String key : keys) {
for (Map.Entry<String, String> entry : url.getParameters().entrySet()) {
String k = entry.getKey();
String v = entry.getValue();
if ((k.equals(key) || k.endsWith("." + key))
&& ConfigUtils.isNotEmpty(v)) {
return true;
}
}
}
return false;
}
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:18,代码来源:ExtensionLoader.java
示例4: checkApplication
import com.alibaba.dubbo.common.utils.ConfigUtils; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void checkApplication() {
// 兼容旧版本
if (application == null) {
String applicationName = ConfigUtils.getProperty("dubbo.application.name");
if (applicationName != null && applicationName.length() > 0) {
application = new ApplicationConfig();
}
}
if (application == null) {
throw new IllegalStateException(
"No such application config! Please add <dubbo:application name=\"...\" /> to your spring config.");
}
//填充各种Application的信息
appendProperties(application);
String wait = ConfigUtils.getProperty(Constants.SHUTDOWN_WAIT_KEY);
if (wait != null && wait.trim().length() > 0) {
System.setProperty(Constants.SHUTDOWN_WAIT_KEY, wait.trim());
} else {
wait = ConfigUtils.getProperty(Constants.SHUTDOWN_WAIT_SECONDS_KEY);
if (wait != null && wait.trim().length() > 0) {
System.setProperty(Constants.SHUTDOWN_WAIT_SECONDS_KEY, wait.trim());
}
}
}
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:27,代码来源:AbstractInterfaceConfig.java
示例5: checkApplication
import com.alibaba.dubbo.common.utils.ConfigUtils; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void checkApplication() {
// 兼容旧版本
if (application == null) {
String applicationName = ConfigUtils.getProperty("dubbo.application.name");
if (applicationName != null && applicationName.length() > 0) {
application = new ApplicationConfig();
}
}
if (application == null) {
throw new IllegalStateException(
"No such application config! Please add <dubbo:application name=\"...\" /> to your spring config.");
}
appendProperties(application);
String wait = ConfigUtils.getProperty(Constants.SHUTDOWN_WAIT_KEY);
if (wait != null && wait.trim().length() > 0) {
System.setProperty(Constants.SHUTDOWN_WAIT_KEY, wait.trim());
} else {
wait = ConfigUtils.getProperty(Constants.SHUTDOWN_WAIT_SECONDS_KEY);
if (wait != null && wait.trim().length() > 0) {
System.setProperty(Constants.SHUTDOWN_WAIT_SECONDS_KEY, wait.trim());
}
}
}
开发者ID:zhuxiaolei,项目名称:dubbo2,代码行数:26,代码来源:AbstractInterfaceConfig.java
示例6: invoke
import com.alibaba.dubbo.common.utils.ConfigUtils; //导入依赖的package包/类
public Result invoke(Invoker<?> invoker, Invocation invocation) throws JahhanException {
String host = ConfigUtils.getProperty("dubbo.protocol.host",NetUtils.getLocalHost());
RpcContext.getContext()
.setInvoker(invoker)
.setInvocation(invocation)
.setLocalAddress(host, 0)
.setRemoteAddress(invoker.getUrl().getHost(),
invoker.getUrl().getPort());
RpcContext.getContext().setAttachment("request_id", UUID.randomUUID().toString());
RpcContext.getContext().setAttachment("chain_id", BaseVariable.getBaseVariable().getChainId());
if (invocation instanceof RpcInvocation) {
((RpcInvocation)invocation).setInvoker(invoker);
}
try {
return invoker.invoke(invocation);
} finally {
RpcContext.getContext().clearAttachments();
}
}
开发者ID:nince-wyj,项目名称:jahhan,代码行数:20,代码来源:ConsumerContextFilter.java
示例7: AbstractRegistry
import com.alibaba.dubbo.common.utils.ConfigUtils; //导入依赖的package包/类
public AbstractRegistry(URL url) {
setUrl(url);
// 启动文件保存定时器
syncSaveFile = url.getParameter(Constants.REGISTRY_FILESAVE_SYNC_KEY, false);
String filename = url.getParameter(Constants.FILE_KEY, System.getProperty("user.home") + "/.dubbo/dubbo-registry-" + url.getHost() + ".cache");
File file = null;
if (ConfigUtils.isNotEmpty(filename)) {
file = new File(filename);
if(! file.exists() && file.getParentFile() != null && ! file.getParentFile().exists()){
if(! file.getParentFile().mkdirs()){
throw new IllegalArgumentException("Invalid registry store file " + file + ", cause: Failed to create directory " + file.getParentFile() + "!");
}
}
}
this.file = file;
loadProperties();
notify(url.getBackupUrls());
}
开发者ID:xingmima,项目名称:dubbos,代码行数:19,代码来源:AbstractRegistry.java
示例8: invoke
import com.alibaba.dubbo.common.utils.ConfigUtils; //导入依赖的package包/类
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
if (cacheFactory != null && ConfigUtils.isNotEmpty(invoker.getUrl().getMethodParameter(invocation.getMethodName(), Constants.CACHE_KEY))) {
Cache cache = cacheFactory.getCache(invoker.getUrl().addParameter(Constants.METHOD_KEY, invocation.getMethodName()));
if (cache != null) {
String key = StringUtils.toArgumentString(invocation.getArguments());
Object value = cache.get(key);
if (value != null) {
return new RpcResult(value);
}
Result result = invoker.invoke(invocation);
if (! result.hasException()) {
cache.put(key, result.getValue());
}
return result;
}
}
return invoker.invoke(invocation);
}
开发者ID:linux-china,项目名称:dubbo3,代码行数:19,代码来源:CacheFilter.java
示例9: isActive
import com.alibaba.dubbo.common.utils.ConfigUtils; //导入依赖的package包/类
private boolean isActive(Activate activate, URL url) {
String[] keys = activate.value();
if (keys.length == 0) {
return true;
}
for (String key : keys) {
for (Map.Entry<String, String> entry : url.getParameters().entrySet()) {
String k = entry.getKey();
String v = entry.getValue();
if ((k.equals(key) || k.endsWith("." + key))
&& ConfigUtils.isNotEmpty(v)) {
return true;
}
}
}
return false;
}
开发者ID:linux-china,项目名称:dubbo3,代码行数:18,代码来源:ExtensionLoader.java
注:本文中的com.alibaba.dubbo.common.utils.ConfigUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论