From 3ef23c74b21fa6b40015f175ffbe2d3bbd8333a7 Mon Sep 17 00:00:00 2001 From: Derek Williams Date: Mon, 28 Feb 2011 10:32:31 -0700 Subject: [PATCH] no need to hold onto the lock to throw the exception --- akka-actor/src/main/scala/akka/dispatch/Future.scala | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/akka-actor/src/main/scala/akka/dispatch/Future.scala b/akka-actor/src/main/scala/akka/dispatch/Future.scala index 607bcb3d0b..71bb644926 100644 --- a/akka-actor/src/main/scala/akka/dispatch/Future.scala +++ b/akka-actor/src/main/scala/akka/dispatch/Future.scala @@ -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 = {