示例#1
0
 public _RepeatingTestThread_367(RPCCallBenchmark _enclosing, RPCCallBenchmark.RpcServiceWrapper
                                 proxy, string echoMessage, MultithreadedTestUtil.TestContext baseArg1)
     : base(baseArg1)
 {
     this._enclosing  = _enclosing;
     this.proxy       = proxy;
     this.echoMessage = echoMessage;
 }
示例#2
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Exception"/>
        private MultithreadedTestUtil.TestContext SetupClientTestContext(RPCCallBenchmark.MyOptions
                                                                         opts)
        {
            if (opts.clientThreads <= 0)
            {
                return(null);
            }
            // Set up a separate proxy for each client thread,
            // rather than making them share TCP pipes.
            int numProxies = opts.clientThreads;

            RPCCallBenchmark.RpcServiceWrapper[] proxies = new RPCCallBenchmark.RpcServiceWrapper
                                                           [numProxies];
            for (int i = 0; i < numProxies; i++)
            {
                proxies[i] = UserGroupInformation.CreateUserForTesting("proxy-" + i, new string[]
                                                                       {  }).DoAs(new _PrivilegedExceptionAction_347(this, opts));
            }
            // Create an echo message of the desired length
            StringBuilder msgBuilder = new StringBuilder(opts.msgSize);

            for (int c = 0; c < opts.msgSize; c++)
            {
                msgBuilder.Append('x');
            }
            string echoMessage = msgBuilder.ToString();

            // Create the clients in a test context
            MultithreadedTestUtil.TestContext ctx = new MultithreadedTestUtil.TestContext();
            for (int i_1 = 0; i_1 < opts.clientThreads; i_1++)
            {
                RPCCallBenchmark.RpcServiceWrapper proxy = proxies[i_1 % numProxies];
                ctx.AddThread(new _RepeatingTestThread_367(this, proxy, echoMessage, ctx));
            }
            return(ctx);
        }