no need to hold onto the lock to throw the exception

This commit is contained in:
Derek Williams 2011-02-28 10:32:31 -07:00
parent 70cc5b706b
commit 3ef23c74b2

View file

@ -395,12 +395,8 @@ class DefaultCompletableFuture[T](timeout: Long, timeunit: TimeUnit) extends Com
def await = {
_lock.lock
try {
if (awaitUnsafe(timeoutInNanos - (currentTimeInNanos - _startTimeInNanos))) this
else throw new FutureTimeoutException("Futures timed out after [" + NANOS.toMillis(timeoutInNanos) + "] milliseconds")
} finally {
_lock.unlock
}
if (try { awaitUnsafe(timeoutInNanos - (currentTimeInNanos - _startTimeInNanos)) } finally { _lock.unlock }) this
else throw new FutureTimeoutException("Futures timed out after [" + NANOS.toMillis(timeoutInNanos) + "] milliseconds")
}
def awaitBlocking = {