future Questions
1
Solved
I have a method that, depending on a predicate, will return one future or another. In other words, an if-else expression that returns a future:
extern crate futures; // 0.1.23
use futures::{futur...
Fertilization asked 16/8, 2018 at 21:45
3
Solved
I have two external call which
Which gives Future[Seq[People]]
Which takes person_id and returns person_status as Future[String]
I need to update each person status using second call from the ...
3
Solved
my way of testing futures was using value1.
I migrated to play2.2. I found out, my accustomed way to test is gone.
@scala.deprecated("Use scala.concurrent.Promise instead.", "2.2")
Any help would...
Homozygous asked 2/10, 2013 at 7:31
2
Solved
If I understand the following code from the QFutureWatcher documentation correctly, then there is a race condition between the last to lines:
// Instantiate the objects and connect to the finished...
Macruran asked 21/9, 2012 at 8:46
1
Solved
I'd like to take a regular iterator and turn it into a stream so that I can do further stream processing. The trouble is that I may have an iterator or an error to deal with. I think I'm pretty clo...
Tuition asked 30/6, 2018 at 12:10
1
Solved
Is it possible to loop over a Vec, calling a method that returns a Future on each, and build a chain of Futures, to be evaluated (eventually) by the consumer? Whether to execute the later Futures w...
3
I'm just starting to learn Akka Actors in Scala. My understanding is that messages received by an Actor are queued in an Actor's mailbox, and processed one at a time. By processing messages one at ...
1
I have started to recently use futures in Rust, but I couldn't find any way to print the future value for debugging purpose. I get this error even with the formatting helper:
^^^^^^^^ `futures::Fu...
4
Solved
This is a followup to my previous question.
Suppose I have a task, which executes an interruptible blocking call. I would like to run it as a Future and cancel it with failure method of Promise.
...
Crepe asked 15/4, 2013 at 17:15
1
Solved
I'm building a service in Rust using tokio-rs and was happy with this tech stack so far. I'm now trying to chain up async operations that includes writes and having a hard time with the borrow chec...
Wicklow asked 17/5, 2018 at 12:37
3
I want to read a large file, process each line and insert the results into a database.
My goal is to parallelize the processing of the lines, as each process is a longrunning task. Therefore I want...
Pulverulent asked 16/5, 2018 at 15:2
3
Solved
There are some good hints how to combine futures with timeouts.
However I'm curious how to do this with Future sequence sequenceOfFutures
My first approach looks like this
import scala.concurrent...
7
Solved
I have to run multiple futures in parallel and the program shouldn't crash or hang.
For now I wait on futures one by one, and use fallback value if there is TimeoutException.
val future1 = // sta...
Flashgun asked 4/7, 2013 at 9:37
1
Solved
A std::future has a std::future::valid method, which indicates whether the future object refers to some shared state. None of the constructors construct a future object that refers to shared state ...
2
Solved
In Scala and other programming languages one can use Futures and Await.
(In real code one would use e.g. zip+map instead of Await)
def b1() = Future { 1 }
def b2() = Future { 2 }
def a() = Futur...
Counterespionage asked 23/4, 2018 at 8:25
2
I know that I can transform a Seq[Future[T]] into a Future[Seq[T]] via
val seqFuture = Future.sequence(seqOfFutures)
seqFuture.map((seqT: Seq[T]) => {...})
My problem now is, that I have 70...
Gowk asked 19/4, 2018 at 15:33
4
I want to create a Future of type Future[(Class1,Class2,Class3)] from below code. However the only way I have found to do this is by using zip(). I find the solution ugly and properly not optimal. ...
Highbinder asked 22/6, 2012 at 13:52
3
Solved
We observed a strange behavior when we tried to start a number of futures from within an actor's receive method.
If we use our configured dispatchers as ExecutionContext, the futures run on the sa...
Gignac asked 6/4, 2018 at 14:15
2
Solved
The andThen meaning I learned from this answer is a function composer.
Say that
f andThen g andThen h
will equal to
h(g(f(x)))
This implies the h function will receive input from g(f(x))
B...
3
I love how scala is type safe, but one runtime error I keep running into is
Future.filter predicate is not satisfied
I can see why I am getting this error, just looking for advice on how to bes...
Cincinnatus asked 3/1, 2016 at 2:22
1
Solved
Having an asynchronous function that doesn't return a value, what's the ideal return type Future<Null> or Future<void>?, or more specifically, what's the difference in using either? Bot...
Calliecalligraphy asked 21/3, 2018 at 15:17
1
Solved
I've got a map of objects which are expensive to create, and so I want to create the objects and fill the map in parallel with other processes in my application. Only when the main thread actually ...
Jab asked 7/11, 2017 at 11:28
2
Solved
I've just started experimenting with futures/tokio in Rust. I can do really basic things with just futures or just with streams. I was wondering how you can select between future and a stream.
How...
Brightwork asked 21/3, 2017 at 13:22
3
Solved
I'd like to await a scala future that may have failed. If I use Await.result the exception will be thrown. Instead, if I have f: Future[String] I would like a method Await.resultOpt(f): Option[Stri...
1
Solved
Help to explain 2 phenomenon for scala future(Bold in code4 & code5), thanks.
Code1
package com.tst
import akka.actor.{Actor, ActorSystem, Props}
import scala.concurrent.ExecutionContext.Impl...
© 2022 - 2024 — McMap. All rights reserved.