public void CancelButNotInterruptBeforeRun() { FutureTask<string> ft = new FutureTask<string>(new FooCallable1()); Assert.IsTrue(ft.Cancel(false)); ft.Run(); Assert.IsTrue(ft.IsDone); Assert.IsTrue(ft.IsCancelled); }
public void CancelAndInterruptTheRunningTask() { FutureTask<int> ft = new FutureTask<int>(new InmediatlyCallable(13)); ft.Run(); Assert.IsFalse(ft.Cancel(true)); Assert.IsTrue(ft.IsDone); Assert.IsFalse(ft.IsCancelled); }
public void CancelAndInterruptBeforeRun() { var ft = new FutureTask<string>(new FooCallable1()); ft.Cancel(true); ft.Run(); Assert.IsTrue(ft.IsDone); Assert.IsTrue(ft.IsCancelled); }
public void CancelButNotInterruptBeforeRun() { var ft = new FutureTask <string>(new FooCallable1()); Assert.IsTrue(ft.Cancel(false)); ft.Run(); Assert.IsTrue(ft.IsDone); Assert.IsTrue(ft.IsCancelled); }
public void CancelAndInterruptTheRunningTask() { var ft = new FutureTask <int>(new InmediatlyCallable(13)); ft.Run(); Assert.IsFalse(ft.Cancel(true)); Assert.IsTrue(ft.IsDone); Assert.IsFalse(ft.IsCancelled); }
public void CancelButNotInterruptTheRunningTask() { //The Task takes 5 seconds. FutureTask<string> ft = new FutureTask<string>(new FooCallable1()); Thread t = new Thread(ft.Run); t.Start(); Thread.Sleep(100); Assert.IsTrue(ft.Cancel(false)); //Not interrupt because the task running t.Join(); Assert.IsTrue(ft.IsDone); Assert.IsTrue(ft.IsCancelled); }
public void CancelButNotInterruptTheRunningTask() { //The Task takes 5 seconds. var ft = new FutureTask <string>(new FooCallable1()); var t = new Thread(ft.Run); t.Start(); Thread.Sleep(100); Assert.IsTrue(ft.Cancel(false)); //Not interrupt because the task running t.Join(); Assert.IsTrue(ft.IsDone); Assert.IsTrue(ft.IsCancelled); }