As per the Future contract, throw CancellationException if the Promise has been cancelled.

This commit is contained in:
Simone Bordet 2012-06-11 14:23:53 +02:00
parent 836c647fb8
commit af836eb4b7
1 changed files with 3 additions and 0 deletions

View File

@ -16,6 +16,7 @@
package org.eclipse.jetty.spdy;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@ -89,6 +90,8 @@ public class Promise<T> implements Handler<T>, Future<T>
private T result() throws ExecutionException
{
if (isCancelled())
throw new CancellationException();
Throwable failure = this.failure;
if (failure != null)
throw new ExecutionException(failure);