public void ShutdownNoContinueExisting()
        {
            ScheduledThreadPoolExecutor e = new ScheduledThreadPoolExecutor(5, Executors.DefaultThreadFactory());

            e.SetExecuteExistingDelayedTasksAfterShutdownPolicy(false);

            bool run = false;

            e.Schedule(new RunnableAction(delegate {
                run = true;
            }), 100, TimeUnit.MILLISECONDS);

            Thread.Sleep(50);

            e.Shutdown();
            Assert.IsTrue(e.IsShutdown());
            Assert.IsTrue(e.IsTerminated(), "Terminated");
            Assert.IsFalse(e.IsTerminating(), "Terminating");

            Thread.Sleep(100);

            Assert.IsFalse(run);
            Assert.IsTrue(e.IsTerminated(), "Terminated");
            Assert.IsFalse(e.IsTerminating(), "Terminating");
        }
		static BatchingProgressMonitor()
		{
			// To support garbage collection, start our thread but
			// swap out the thread factory. When our class is GC'd
			// the alarmQueueKiller will finalize and ask the executor
			// to shutdown, ending the worker.
			//
			int threads = 1;
			alarmQueue = new ScheduledThreadPoolExecutor(threads, new _ThreadFactory_66());
			alarmQueue.SetContinueExistingPeriodicTasksAfterShutdownPolicy(false);
			alarmQueue.SetExecuteExistingDelayedTasksAfterShutdownPolicy(false);
			alarmQueue.PrestartAllCoreThreads();
			// Now that the threads are running, its critical to swap out
			// our own thread factory for one that isn't in the ClassLoader.
			// This allows the class to GC.
			//
			alarmQueue.SetThreadFactory(Executors.DefaultThreadFactory());
			alarmQueueKiller = new _object_87();
		}
        static BatchingProgressMonitor()
        {
            // To support garbage collection, start our thread but
            // swap out the thread factory. When our class is GC'd
            // the alarmQueueKiller will finalize and ask the executor
            // to shutdown, ending the worker.
            //
            int threads = 1;

            alarmQueue = new ScheduledThreadPoolExecutor(threads, new _ThreadFactory_66());
            alarmQueue.SetContinueExistingPeriodicTasksAfterShutdownPolicy(false);
            alarmQueue.SetExecuteExistingDelayedTasksAfterShutdownPolicy(false);
            alarmQueue.PrestartAllCoreThreads();
            // Now that the threads are running, its critical to swap out
            // our own thread factory for one that isn't in the ClassLoader.
            // This allows the class to GC.
            //
            alarmQueue.SetThreadFactory(Executors.DefaultThreadFactory());
            alarmQueueKiller = new _object_87();
        }
		public void ShutdownNoContinueExisting ()
		{
			ScheduledThreadPoolExecutor e = new ScheduledThreadPoolExecutor (5, Executors.DefaultThreadFactory ());
			e.SetExecuteExistingDelayedTasksAfterShutdownPolicy (false);
			
			bool run = false;
			e.Schedule (new RunnableAction (delegate {
				run = true;
			}),100, TimeUnit.MILLISECONDS);
			
			Thread.Sleep (50);
			
			e.Shutdown ();
			Assert.IsTrue (e.IsShutdown ());
			Assert.IsTrue (e.IsTerminated (), "Terminated");
			Assert.IsFalse (e.IsTerminating (), "Terminating");
			
			Thread.Sleep (100);
			
			Assert.IsFalse (run);
			Assert.IsTrue (e.IsTerminated (), "Terminated");
			Assert.IsFalse (e.IsTerminating (), "Terminating");
		}