コード例 #1
0
        private void TryStatementCreateSendAndStop(EPServiceProvider epService, int numThreads, object[][] statements, int numRepeats)
        {
            var threadPool = Executors.NewFixedThreadPool(numThreads);
            var future     = new Future <bool> [numThreads];

            for (int i = 0; i < numThreads; i++)
            {
                var callable = new StmtMgmtCallable(epService, statements, numRepeats);
                future[i] = threadPool.Submit(callable);
            }

            threadPool.Shutdown();
            threadPool.AwaitTermination(10, TimeUnit.SECONDS);

            var statementDigest = new StringBuilder();

            for (int i = 0; i < statements.Length; i++)
            {
                statementDigest.Append(CompatExtensions.Render(statements[i]));
            }

            for (int i = 0; i < numThreads; i++)
            {
                Assert.IsTrue(future[i].GetValueOrDefault(), "Failed in " + statementDigest);
            }
        }
コード例 #2
0
ファイル: TestMTStmtMgmt.cs プロジェクト: valmac/nesper
        private void TryStatementCreateSendAndStop(int numThreads, Object[][] statements, int numRepeats)
        {
            var threadPool = Executors.NewFixedThreadPool(numThreads);
            var future     = new Future <bool> [numThreads];

            for (int i = 0; i < numThreads; i++)
            {
                var callable = new StmtMgmtCallable(_engine, statements, numRepeats);
                future[i] = threadPool.Submit(callable);
            }

            threadPool.Shutdown();
            threadPool.AwaitTermination(new TimeSpan(0, 0, 10));

            StringBuilder statementDigest = new StringBuilder();

            for (int i = 0; i < statements.Length; i++)
            {
                statementDigest.Append(statements[i].Render());
            }

            for (int i = 0; i < numThreads; i++)
            {
                Assert.IsTrue(future[i].GetValueOrDefault(), "Failed in " + statementDigest);
            }
        }