no need to hold onto the lock to throw the exception
This commit is contained in:
parent
70cc5b706b
commit
3ef23c74b2
1 changed files with 2 additions and 6 deletions
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue