Example #1
0
        private void TrySend(int numThreads, int numRepeats, EPStatement[] stmt)
        {
            BasicExecutorService threadPool = Executors.NewFixedThreadPool(numThreads);

            Future <bool>[] future = new Future <bool> [numThreads];
            for (int i = 0; i < numThreads; i++)
            {
                ICallable <bool> callable = new StmtIterateCallable(i, _engine, stmt, numRepeats);
                future[i] = threadPool.Submit(callable);
            }

            threadPool.Shutdown();
            threadPool.AwaitTermination(TimeSpan.FromSeconds(5));

            for (int i = 0; i < numThreads; i++)
            {
                Assert.IsTrue(future[i].GetValueOrDefault());
            }
        }
Example #2
0
        private void TrySend(EPServiceProvider epService, int numThreads, int numRepeats, EPStatement[] stmt)
        {
            var threadPool = Executors.NewFixedThreadPool(numThreads);
            var future     = new Future <bool> [numThreads];

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

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

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