本文整理汇总了Java中com.alibaba.dubbo.rpc.Exporter.getInvoker方法的典型用法代码示例。如果您正苦于以下问题:Java Exporter.getInvoker方法的具体用法?Java Exporter.getInvoker怎么用?Java Exporter.getInvoker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.dubbo.rpc.Exporter
的用法示例。
在下文中一共展示了Exporter.getInvoker方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findMethod
import com.alibaba.dubbo.rpc.Exporter; //导入方法依赖的package包/类
private static Method findMethod(Exporter<?> exporter, String method, List<Object> args) {
Invoker<?> invoker = exporter.getInvoker();
Method[] methods = invoker.getInterface().getMethods();
Method invokeMethod = null;
for (Method m : methods) {
if (m.getName().equals(method) && m.getParameterTypes().length == args.size()) {
if (invokeMethod != null) { // 重载
if (isMatch(invokeMethod.getParameterTypes(), args)) {
invokeMethod = m;
break;
}
} else {
invokeMethod = m;
}
invoker = exporter.getInvoker();
}
}
return invokeMethod;
}
示例2: findMethod
import com.alibaba.dubbo.rpc.Exporter; //导入方法依赖的package包/类
private static Method findMethod(Exporter<?> exporter, String method, List<Object> args) {
Invoker<?> invoker = exporter.getInvoker();
Method[] methods = invoker.getInterface().getMethods();
for (Method m : methods) {
if (m.getName().equals(method) && isMatch(m.getParameterTypes(), args)) {
return m;
}
}
return null;
}
示例3: telnet
import com.alibaba.dubbo.rpc.Exporter; //导入方法依赖的package包/类
public String telnet(Channel channel, String message) {
String service = (String) channel.getAttribute(ChangeTelnetHandler.SERVICE_KEY);
if ((service == null || service.length() == 0)
&& (message == null || message.length() == 0)) {
return "Please input service name, eg: \r\ntrace XxxService\r\ntrace XxxService xxxMethod\r\ntrace XxxService xxxMethod 10\r\nor \"cd XxxService\" firstly.";
}
String[] parts = message.split("\\s+");
String method;
String times;
if (service == null || service.length() == 0) {
service = parts.length > 0 ? parts[0] : null;
method = parts.length > 1 ? parts[1] : null;
} else {
method = parts.length > 0 ? parts[0] : null;
}
if (StringUtils.isInteger(method)) {
times = method;
method = null;
} else {
times = parts.length > 2 ? parts[2] : "1";
}
if (! StringUtils.isInteger(times)) {
return "Illegal times " + times + ", must be integer.";
}
Invoker<?> invoker = null;
for (Exporter<?> exporter : DubboProtocol.getDubboProtocol().getExporters()) {
if (service.equals(exporter.getInvoker().getInterface().getSimpleName())
|| service.equals(exporter.getInvoker().getInterface().getName())
|| service.equals(exporter.getInvoker().getUrl().getPath())) {
invoker = exporter.getInvoker();
break;
}
}
if (invoker != null) {
if (method != null && method.length() > 0) {
boolean found = false;
for (Method m : invoker.getInterface().getMethods()) {
if (m.getName().equals(method)) {
found = true;
break;
}
}
if (! found) {
return "No such method " + method + " in class " + invoker.getInterface().getName();
}
}
TraceFilter.addTracer(invoker.getInterface(), method, channel, Integer.parseInt(times));
} else {
return "No such service " + service;
}
return null;
}