/// <summary> /// Creates a <see cref="FutureTask{T}"/> that will, upon running, execute the /// given <see cref="IRunnable"/>, and arrange that <see cref="GetResult()"/> /// will return the given <paramref name="result"/> upon successful completion. /// </summary> /// <param name="task">The runnable task.</param> /// <param name="result"> /// The result to return on successful completion. If /// you don't need a particular result, consider using /// constructions of the form: /// <code language="c#"> /// Future f = new FutureTask(runnable, default(T)) /// </code> /// </param> /// <exception cref="System.ArgumentNullException"> /// If the <paramref name="task"/> is <c>null</c>. /// </exception> public FutureTask(IRunnable task, T result) : this(Executors.CreateCallable(task, result)) { }
/// <summary> /// Creates a <see cref="FutureTask{T}"/> that will, upon running, execute the /// given <see cref="Action"/>, and arrange that <see cref="GetResult()"/> /// will return the given <paramref name="result"/> upon successful completion. /// </summary> /// <param name="action">The <see cref="Action"/> delegate.</param> /// <param name="result"> /// The result to return on successful completion. If /// you don't need a particular result, consider using /// constructions of the form: /// <code language="c#"> /// Future f = new FutureTask(action, default(T)) /// </code> /// </param> /// <exception cref="ArgumentNullException"> /// If the <paramref name="action"/> is <c>null</c>. /// </exception> public FutureTask(Action action, T result) : this(Executors.CreateCallable(action, result)) { }
/// <summary> /// Creates a <see cref="FutureTask{T}"/> that will, upon running, execute the /// given <see cref="Func{T}"/> delegate. /// </summary> /// <param name="call">The <see cref="Func{T}"/> delegate.</param> /// <exception cref="System.ArgumentNullException"> /// If the <paramref name="call"/> is <c>null</c>. /// </exception> public FutureTask(Func <T> call) : this(Executors.CreateCallable(call)) { }