private static void TryMT(
            RegressionEnvironment env,
            int numSeconds)
        {
            var epl =
                "create table MyTable (p0 string, p1 string, p2 string, p3 string, p4 string);\n" +
                "on SupportBean merge MyTable " +
                "  when not matched then insert select '1' as p0, '1' as p1, '1' as p2, '1' as p3, '1' as p4;\n" +
                "on SupportBean_S0 merge MyTable " +
                "  when matched then update set p0=P00, p1=P00, p2=P00, p3=P00, p4=P00;\n" +
                "@Name('out') select p0 from SupportBean_S1 unidirectional, MyTable where " +
                "(p0='1' and p1='1' and p2='1' and p3='1' and p4='1')" +
                " or (p0='2' and p1='2' and p2='2' and p3='2' and p4='2')" +
                ";\n";
            env.CompileDeploy(epl);

            // preload
            env.SendEventBean(new SupportBean());

            var writeRunnable = new UpdateWriteRunnable(env);
            var readRunnable = new ReadRunnable(env);

            // start
            var threadWrite = new Thread(writeRunnable.Run) {
                Name = typeof(InfraTableMTUngroupedJoinColumnConsistency).Name + "-write"
            };
            var threadRead = new Thread(readRunnable.Run) {
                Name = typeof(InfraTableMTUngroupedJoinColumnConsistency).Name + "-read"
            };
            threadWrite.Start();
            threadRead.Start();

            // wait
            Thread.Sleep(numSeconds * 1000);

            // shutdown
            writeRunnable.Shutdown = true;
            readRunnable.Shutdown = true;

            // join
            log.Info("Waiting for completion");
            threadWrite.Join();
            threadRead.Join();

            env.UndeployAll();
            Assert.IsNull(writeRunnable.Exception);
            Assert.IsNull(readRunnable.Exception);
            Console.Out.WriteLine(
                "Write loops " + writeRunnable.numLoops + " and performed " + readRunnable.numQueries + " reads");
            Assert.IsTrue(writeRunnable.numLoops > 1);
            Assert.IsTrue(readRunnable.numQueries > 100);
        }
        private void TryMT(EPServiceProvider epService, int numSeconds)
        {
            string epl =
                "create table MyTable (p0 string, p1 string, p2 string, p3 string, p4 string);\n" +
                "on SupportBean merge MyTable " +
                "  when not matched then insert select '1' as p0, '1' as p1, '1' as p2, '1' as p3, '1' as p4;\n" +
                "on SupportBean_S0 merge MyTable " +
                "  when matched then update set p0=p00, p1=p00, p2=p00, p3=p00, p4=p00;\n" +
                "@Name('out') select p0 from SupportBean_S1 unidirectional, MyTable where " +
                "(p0='1' and p1='1' and p2='1' and p3='1' and p4='1')" +
                " or (p0='2' and p1='2' and p2='2' and p3='2' and p4='2')" +
                ";\n";

            epService.EPAdministrator.DeploymentAdmin.ParseDeploy(epl);

            // preload
            epService.EPRuntime.SendEvent(new SupportBean());

            var writeRunnable = new UpdateWriteRunnable(epService);
            var readRunnable  = new ReadRunnable(epService);

            // start
            var threadWrite = new Thread(writeRunnable.Run);
            var threadRead  = new Thread(readRunnable.Run);

            threadWrite.Start();
            threadRead.Start();

            // wait
            Thread.Sleep(numSeconds * 1000);

            // shutdown
            writeRunnable.SetShutdown(true);
            readRunnable.SetShutdown(true);

            // join
            Log.Info("Waiting for completion");
            threadWrite.Join();
            threadRead.Join();

            Assert.IsNull(writeRunnable.Exception);
            Assert.IsNull(readRunnable.Exception);
            Log.Info("Write loops " + writeRunnable.NumLoops + " and performed " + readRunnable.NumQueries + " reads");
            Assert.IsTrue(writeRunnable.NumLoops > 1);
            Assert.IsTrue(readRunnable.NumQueries > 100);
        }