Package com.alibaba.dubbo.rpc

Examples of com.alibaba.dubbo.rpc.Invocation


                try {
                    client = RemoteServer.getClientHost();
                } catch (ServerNotActiveException e) {
                    // Ignore it.
                }
                Invocation inv = new RpcInvocation(invocation.getMethodName(),
                        invocation.getParameterTypes(), invocation.getArguments());
                try {
                    RpcContext.getContext().setRemoteAddress(client, 0);
                    return invoker.invoke(inv).recreate();
                } catch (RpcException e) {
View Full Code Here


        }
        return providerUrl;
    }

    private List<Invoker<T>> route(List<Invoker<T>> invokers, String method) {
        Invocation invocation = new RpcInvocation(method, new Class<?>[0], new Object[0]);
        List<Router> routers = getRouters();
        if (routers != null) {
            for (Router router : routers) {
                if (router.getUrl() != null && ! router.getUrl().getParameter(Constants.RUNTIME_KEY, true)) {
                    invokers = router.route(invokers, getUrl(), invocation);
View Full Code Here

        }
        return providerUrl;
    }

    private List<Invoker<T>> route(List<Invoker<T>> invokers, String method) {
        Invocation invocation = new RpcInvocation(method, new Class<?>[0], new Object[0]);
        List<Router> routers = getRouters();
        if (routers != null) {
            for (Router router : routers) {
                if (router.getUrl() != null && ! router.getUrl().getParameter(Constants.RUNTIME_KEY, true)) {
                    invokers = router.route(invokers, getUrl(), invocation);
View Full Code Here

        }
        return providerUrl;
    }

    private List<Invoker<T>> route(List<Invoker<T>> invokers, String method) {
        Invocation invocation = new RpcInvocation(method, new Class<?>[0], new Object[0]);
        List<Router> routers = getRouters();
        if (routers != null) {
            for (Router router : routers) {
                if (router.getUrl() != null && ! router.getUrl().getParameter(Constants.RUNTIME_KEY, true)) {
                    invokers = router.route(invokers, getUrl(), invocation);
View Full Code Here

        }
        return providerUrl;
    }

    private List<Invoker<T>> route(List<Invoker<T>> invokers, String method) {
        Invocation invocation = new RpcInvocation(method, new Class<?>[0], new Object[0]);
        List<Router> routers = getRouters();
        if (routers != null) {
            for (Router router : routers) {
                if (router.getUrl() != null && ! router.getUrl().getParameter(Constants.RUNTIME_KEY, true)) {
                    invokers = router.route(invokers, getConsumerUrl(), invocation);
View Full Code Here

        }
    }

    protected void encodeRequest(Channel channel, OutputStream output, Request request)
        throws IOException {
        Invocation invocation = (Invocation) request.getData();
        TProtocol protocol = newProtocol(channel.getUrl(), output);
        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);
        }
View Full Code Here

        if (failed.size() == 0) {
            return;
        }
        for (Map.Entry<Invocation, AbstractClusterInvoker<?>> entry : new HashMap<Invocation, AbstractClusterInvoker<?>>(
                                                                                                                         failed).entrySet()) {
            Invocation invocation = entry.getKey();
            Invoker<?> invoker = entry.getValue();
            try {
                invoker.invoke(invocation);
                failed.remove(invocation);
            } catch (Throwable e) {
                logger.error("Failed retry to invoke method " + invocation.getMethodName() + ", waiting again.", e);
            }
        }
    }
View Full Code Here

        }
    }

    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);
        }
View Full Code Here

  @Test
  public void testAttachInvocationIdIfAsync_normal() {
    URL url = URL.valueOf("dubbo://localhost/?test.async=true");
    Map<String,String> attachments = new HashMap<String,String>();
    attachments.put("aa", "bb");
    Invocation inv = new RpcInvocation("test", new Class[]{}, new String[]{}, attachments);
    RpcUtils.attachInvocationIdIfAsync(url, inv);
    long id1 = RpcUtils.getInvocationId(inv);
    RpcUtils.attachInvocationIdIfAsync(url, inv);
    long id2 = RpcUtils.getInvocationId(inv);
    Assert.assertTrue( id1 == id2); //幂等操作验证
View Full Code Here

   * 验证:acctachment中没有添加id属性
   */
  @Test
  public void testAttachInvocationIdIfAsync_sync() {
    URL url = URL.valueOf("dubbo://localhost/");
    Invocation inv = new RpcInvocation("test", new Class[]{}, new String[]{});
    RpcUtils.attachInvocationIdIfAsync(url, inv);
    Assert.assertNull(RpcUtils.getInvocationId(inv));
  }
View Full Code Here

TOP

Related Classes of com.alibaba.dubbo.rpc.Invocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.