Exemplo n.º 1
0
        private void TrySendAndReceive(EPServiceProvider epService, int numThreads, EPStatement statement, int numRepeats)
        {
            var threadPool = Executors.NewFixedThreadPool(numThreads);
            var future     = new Future <bool> [numThreads];

            for (int i = 0; i < numThreads; i++)
            {
                var callable = new StmtDatabaseJoinCallable(epService, statement, 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 in " + statement.Text);
            }
        }
Exemplo n.º 2
0
        private void TrySendAndReceive(int numThreads, EPStatement statement, int numRepeats)
        {
            var threadPool = Executors.NewFixedThreadPool(numThreads);
            var future     = new Future <bool> [numThreads];

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

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

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