private void TryStatementListenerAddRemove(EPServiceProvider epService, int numThreads, EPStatement statement, bool isEPL, int numRepeats)
        {
            var threadPool = Executors.NewFixedThreadPool(numThreads);
            var future     = new Future <bool> [numThreads];

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

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

            for (int i = 0; i < numThreads; i++)
            {
                Assert.IsTrue(future[i].GetValueOrDefault(), "Failed stmt=" + statement.Text);
            }
        }
Beispiel #2
0
        private void TryStatementListenerAddRemove(int numThreads, EPStatement statement, bool isEPL, int numRepeats)
        {
            var threadPool = new DedicatedExecutorService("test", numThreads);
            var future     = new Future <bool> [numThreads];

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

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

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