Exemple #1
0
        [Test] public void NewDefaultThreadFactoryHasSpecifiedPriorityBackgroundStatusAndName()
        {
            Action r = ThreadManager.GetManagedAction(
                delegate
            {
                Thread current = Thread.CurrentThread;
                Assert.IsTrue(!current.IsBackground);
                Assert.IsTrue(current.Priority <= ThreadPriority.Normal);
                String name = current.Name;
                Assert.IsTrue(name.EndsWith("thread-1"));
            });
            IExecutorService e = Executors.NewSingleThreadExecutor(Executors.NewDefaultThreadFactory());

            e.Execute(r);
            e.Shutdown();
            Thread.Sleep(Delays.Short);
            JoinPool(e);
            ThreadManager.JoinAndVerify();
        }