All Questions
Tagged with futuretask scala
12 questions
3
votes
1
answer
621
views
Why Future(Failure(new Exception)) returns Success instead of failure?
I was trying the following and thinking that I'll get a failure
val failure = Future { Failure(new Exception) }
but instead I got
Future(Success(Failure(java.lang.Exception)))
Can anyone answer why?
2
votes
1
answer
268
views
Scala - Return value from Callbacks
I am fairly new to scala programming. Can someone please help me with return value from callbacks. How could I return a callback value as JsObject from the calling method? I am using the Play2 ...
0
votes
1
answer
97
views
Trying to make sequential executing of futures. What is wrong?
I am trying to execute function which returns Future sequentially
So, I have a collection
val in = Seq(1, 1, -1, -2, 3, -4, 5, 6, 7, -1, -2, -9, 1, 2, 2)
and function to process every int in this ...
4
votes
1
answer
2k
views
When to use Scala Futures?
I'm a spark Scala Programmer. I have a spark job that has sub-tasks which to complete the whole job. I wanted to use Future to complete the subtasks in parallel. On completion of the whole job I have ...
-1
votes
1
answer
652
views
Computation with Futures avoiding Await method
I have funtion which is calling computeParallel() function which is calling 3 Futures F1,F2,F3 and returning String as return type.
def computeParallel():String =
{
val f1 = Future { "ss" }
...
0
votes
2
answers
219
views
Parallel Computation with Scala Futures [closed]
I have a Function that computes two sub-functions like this.
def someFutureMethod1(input: Int): Int = {
input + 1
}
def someFutureMethod2(input: Int): Int = {
input + 12
}
def ...
0
votes
1
answer
222
views
how to execute code after the exception in scala using Try
i have two actors they can either return the Result which is a boolean value in my case or they can throw an exception here is my code
val futureA: Future[Boolean] = ask(ActorA, MessageA(obj)).mapTo[...
1
vote
2
answers
70
views
Mantaining type information on the queue of tasks of a ThreadPool
I am self learning concurrency with the 2 very helpful books:
- Concurrency in the JVM, from Brian Goetz.
- Learning Concurrent Programming in Scala, from Aleksandar Prokopec.
As a test to my ...
2
votes
1
answer
666
views
Catching dangling or unused Futures in Scala
A common problem in our Scala code is that a call that returns a Future[T] will not be awaited (we commonly use the scala-async library because many of us are familiar with async/await from C#) or ...
0
votes
1
answer
574
views
Akka-Java: Unable to receive Future message in parent using pipe pattern
I am creating one child actor for one parent. My child actor perform some business logic and return value to scala Future. When i send Future message to my parent, i am unable to catch my future ...
4
votes
2
answers
4k
views
How to catch RejectedExecutionException when using Scala futures?
Where should I catch RejectedExecutionExceptions when shutting down the executor ? I tried:
future {
Option(reader.readLine)
} onComplete {
case Success(v) =>
case ...
1
vote
1
answer
787
views
How to execute operation in scala with timeout?
Context: I want to write scalding job(hadoop) to crawl pages and I want to set timeout on url extraction(without timeout on URLConnection, I want generic solution for other timeout cases)
i.e. map ...