mirror of
https://github.com/sbt/sbt.git
synced 2026-10-06 18:14:04 +02:00
Treat InterruptedException in CompletionService as task being cancelled
This commit is contained in:
committed by
Alex Zolotko
parent
dca44d570d
commit
7a1a524b4e
@@ -34,8 +34,19 @@ object CompletionService {
|
||||
def take() = completion.take().get()
|
||||
}
|
||||
def submit[T](work: () => T, completion: JCompletionService[T]): () => T = {
|
||||
val future = try completion.submit { new Callable[T] { def call = work() } } catch {
|
||||
case _: RejectedExecutionException => throw Incomplete(None, message = Some("cancelled"))
|
||||
val future = try completion.submit {
|
||||
new Callable[T] {
|
||||
def call =
|
||||
try {
|
||||
work()
|
||||
} catch {
|
||||
case _: InterruptedException =>
|
||||
throw Incomplete(None, message = Some("cancelled"))
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
case _: RejectedExecutionException =>
|
||||
throw Incomplete(None, message = Some("cancelled"))
|
||||
}
|
||||
() => future.get()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user