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


Java RpcInvocation.getArguments方法代码示例

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


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

示例1: encodeRequestData

import com.alibaba.dubbo.rpc.RpcInvocation; //导入方法依赖的package包/类
@Override
protected void encodeRequestData(Channel channel, ObjectOutput out, Object data) throws IOException {
    RpcInvocation inv = (RpcInvocation) data;

    out.writeUTF(inv.getAttachment(Constants.DUBBO_VERSION_KEY, DUBBO_VERSION));
    out.writeUTF(inv.getAttachment(Constants.PATH_KEY));
    out.writeUTF(inv.getAttachment(Constants.VERSION_KEY));

    out.writeUTF(inv.getMethodName());
    out.writeUTF(ReflectUtils.getDesc(inv.getParameterTypes()));
    Object[] args = inv.getArguments();
    if (args != null)
    for (int i = 0; i < args.length; i++){
        out.writeObject(encodeInvocationArgument(channel, inv, i));
    }
    out.writeObject(inv.getAttachments());
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:18,代码来源:DubboCodec.java

示例2: encodeInvocationArgument

import com.alibaba.dubbo.rpc.RpcInvocation; //导入方法依赖的package包/类
public static Object encodeInvocationArgument(Channel channel, RpcInvocation inv, int paraIndex) throws IOException{
    //encode时可直接获取url
    URL url = inv.getInvoker() == null ? null : inv.getInvoker().getUrl();
    byte callbackstatus = isCallBack(url, inv.getMethodName(), paraIndex);
    Object[] args = inv.getArguments();
    Class<?>[] pts = inv.getParameterTypes();
    switch (callbackstatus) {
        case CallbackServiceCodec.CALLBACK_NONE:
            return args[paraIndex];
        case CallbackServiceCodec.CALLBACK_CREATE:
            inv.setAttachment(INV_ATT_CALLBACK_KEY + paraIndex , exportOrunexportCallbackService(channel, url, pts[paraIndex], args[paraIndex], true));
            return null;
        case CallbackServiceCodec.CALLBACK_DESTROY:
            inv.setAttachment(INV_ATT_CALLBACK_KEY + paraIndex, exportOrunexportCallbackService(channel, url, pts[paraIndex], args[paraIndex], false));
            return null;
        default:
            return args[paraIndex];
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:20,代码来源:CallbackServiceCodec.java

示例3: encodeRequestData

import com.alibaba.dubbo.rpc.RpcInvocation; //导入方法依赖的package包/类
@Override
protected void encodeRequestData(Channel channel, ObjectOutput out, Object data) throws IOException {
    RpcInvocation inv = (RpcInvocation) data;

    out.writeUTF(inv.getAttachment(Constants.DUBBO_VERSION_KEY, DUBBO_VERSION));
    out.writeUTF(inv.getAttachment(Constants.PATH_KEY));
    out.writeUTF(inv.getAttachment(Constants.VERSION_KEY));

    out.writeUTF(inv.getMethodName());
    out.writeUTF(ReflectUtils.getDesc(inv.getParameterTypes()));
    Object[] args = inv.getArguments();
    if (args != null)
        for (int i = 0; i < args.length; i++){
            out.writeObject(encodeInvocationArgument(channel, inv, i));
        }
    out.writeObject(inv.getAttachments());
}
 
开发者ID:zhangkewei,项目名称:dubbo-transaction,代码行数:18,代码来源:DubboCodec.java

示例4: encodeRequestData

import com.alibaba.dubbo.rpc.RpcInvocation; //导入方法依赖的package包/类
@Override
protected void encodeRequestData(Channel channel, ObjectOutput out, Object data) throws IOException {
    RpcInvocation inv = (RpcInvocation) data;

    out.writeUTF(inv.getAttachment(Constants.DUBBO_VERSION_KEY, DUBBO_VERSION));
    out.writeUTF(inv.getAttachment(Constants.PATH_KEY));
    out.writeUTF(inv.getAttachment(Constants.VERSION_KEY));

    out.writeUTF(inv.getMethodName());

    // NOTICE modified by lishen
    // TODO
    if (getSerialization(channel) instanceof OptimizedSerialization && !containComplexArguments(inv)) {
        out.writeInt(inv.getParameterTypes().length);
    } else {
        out.writeInt(-1);
        out.writeUTF(ReflectUtils.getDesc(inv.getParameterTypes()));
    }

    Object[] args = inv.getArguments();
    if (args != null)
        for (int i = 0; i < args.length; i++){
            out.writeObject(encodeInvocationArgument(channel, inv, i));
        }
    out.writeObject(inv.getAttachments());
}
 
开发者ID:zhuxiaolei,项目名称:dubbo2,代码行数:27,代码来源:DubboCodec.java

示例5: containComplexArguments

import com.alibaba.dubbo.rpc.RpcInvocation; //导入方法依赖的package包/类
private boolean containComplexArguments(RpcInvocation invocation) {
    for (int i = 0; i < invocation.getParameterTypes().length; i++) {
        if (invocation.getArguments()[i] == null || invocation.getParameterTypes()[i] != invocation.getArguments()[i].getClass()) {
            return true;
        }
    }
    return false;
}
 
开发者ID:zhuxiaolei,项目名称:dubbo2,代码行数:9,代码来源:DubboCodec.java


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