コード例 #1
0
        private void sync(RpcClient client, RpcServer server, int timeout)
        {
            RequestBody b1  = new RequestBody(1, RequestBody.DEFAULT_SYNC_STR);
            object      obj = null;

            try
            {
                if (null == server)
                {
                    obj = client.invokeSync(addr, b1, timeout);
                }
                else
                {
                    Connection conn = client.getConnection(addr, timeout);
                    Assert.NotNull(serverConnectProcessor.Connection);
                    Connection serverConn = serverConnectProcessor.Connection;
                    obj = server.invokeSync(serverConn, b1, timeout);
                }
                Assert.Null("Should not reach here!");
            }
            catch (InvokeTimeoutException)
            {
                Assert.Null(obj);
            }
            catch (RemotingException e)
            {
                logger.LogError("Other RemotingException but RpcServerTimeoutException occurred in sync", e);
                Assert.Null("Should not reach here!");
            }
            catch (ThreadInterruptedException e)
            {
                logger.LogError("ThreadInterruptedException in sync", e);
                Assert.Null("Should not reach here!");
            }
        }