Added Future[T] as return type for await and awaitBlocking
This commit is contained in:
parent
4bc833acae
commit
2b9f7be1a7
1 changed files with 4 additions and 2 deletions
|
|
@ -71,8 +71,8 @@ object Futures {
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed trait Future[T] {
|
sealed trait Future[T] {
|
||||||
def await
|
def await : Future[T]
|
||||||
def awaitBlocking
|
def awaitBlocking : Future[T]
|
||||||
def isCompleted: Boolean
|
def isCompleted: Boolean
|
||||||
def isExpired: Boolean
|
def isExpired: Boolean
|
||||||
def timeoutInNanos: Long
|
def timeoutInNanos: Long
|
||||||
|
|
@ -111,6 +111,7 @@ class DefaultCompletableFuture[T](timeout: Long) extends CompletableFuture[T] {
|
||||||
wait = wait - (currentTimeInNanos - start)
|
wait = wait - (currentTimeInNanos - start)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this
|
||||||
} finally {
|
} finally {
|
||||||
_lock.unlock
|
_lock.unlock
|
||||||
}
|
}
|
||||||
|
|
@ -120,6 +121,7 @@ class DefaultCompletableFuture[T](timeout: Long) extends CompletableFuture[T] {
|
||||||
while (!_completed) {
|
while (!_completed) {
|
||||||
_signal.await
|
_signal.await
|
||||||
}
|
}
|
||||||
|
this
|
||||||
} finally {
|
} finally {
|
||||||
_lock.unlock
|
_lock.unlock
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue