Sets the result of the Task, throwing if the Task has already been completed.
(TResult result)
| 624 | * Sets the result of the Task, throwing if the Task has already been completed. |
| 625 | */ |
| 626 | public void setResult(TResult result) { |
| 627 | if (!trySetResult(result)) { |
| 628 | throw new IllegalStateException("Cannot set the result of a completed task."); |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | /** |
| 633 | * Sets the error of the Task, throwing if the Task has already been completed. |