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); } }
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); } }