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


Java Invocation.getParameterTypes方法代码示例

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


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

示例1: encodeRequest

import com.alibaba.dubbo.rpc.Invocation; //导入方法依赖的package包/类
protected void encodeRequest(Channel channel, ChannelBuffer buffer, Request request)
    throws IOException {
    Invocation invocation = (Invocation) request.getData();
    TProtocol protocol = newProtocol(channel.getUrl(), buffer);
    try {
        protocol.writeMessageBegin(new TMessage(
            invocation.getMethodName(), TMessageType.CALL, 
            thriftSeq.getAndIncrement()));
        protocol.writeStructBegin(new TStruct(invocation.getMethodName() + "_args"));
        for(int i = 0; i < invocation.getParameterTypes().length; i++) {
            Class<?> type = invocation.getParameterTypes()[i];

        }
    } catch (TException e) {
        throw new IOException(e.getMessage(), e);
    }

}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:19,代码来源:ThriftNativeCodec.java

示例2: getParameterTypes

import com.alibaba.dubbo.rpc.Invocation; //导入方法依赖的package包/类
public static Class<?>[] getParameterTypes(Invocation invocation){
	if(Constants.$INVOKE.equals(invocation.getMethodName()) 
            && invocation.getArguments() != null 
            && invocation.getArguments().length > 1
            && invocation.getArguments()[1] instanceof String[]){
        String[] types = (String[]) invocation.getArguments()[1];
        if (types == null) {
        	return new Class<?>[0];
        }
        Class<?>[] parameterTypes = new Class<?>[types.length];
        for (int i = 0; i < types.length; i ++) {
        	parameterTypes[i] = ReflectUtils.forName(types[0]);
        }
        return parameterTypes;
    }
	return invocation.getParameterTypes();
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:18,代码来源:RpcUtils.java

示例3: getMethodSignature

import com.alibaba.dubbo.rpc.Invocation; //导入方法依赖的package包/类
private String getMethodSignature(Invocation invocation) {
    StringBuilder buf = new StringBuilder(invocation.getMethodName());
    buf.append("(");
    Class<?>[] types = invocation.getParameterTypes();
    if (types != null && types.length > 0) {
        boolean first = true;
        for (Class<?> type : types) {
            if (first) {
                first = false;
            } else {
                buf.append(", ");
            }
            buf.append(type.getSimpleName());
        }
    }
    buf.append(")");
    return buf.toString();
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:19,代码来源:DeprecatedFilter.java

示例4: buildOperationName

import com.alibaba.dubbo.rpc.Invocation; //导入方法依赖的package包/类
public static String buildOperationName(Invoker<?> invoker, Invocation inv) {
    String version = invoker.getUrl().getParameter(Constants.VERSION_KEY);
    String group = invoker.getUrl().getParameter(Constants.GROUP_KEY);

    StringBuilder sn = new StringBuilder("Dubbo_");
    sn.append(group).append(":").append(version);
    sn.append("_");
    sn.append(invoker.getInterface().getName()).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(") ");

    return sn.toString();
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:28,代码来源:JbootDubboTracingFilterKits.java

示例5: invoke

import com.alibaba.dubbo.rpc.Invocation; //导入方法依赖的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


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