future Questions
3
I am reading through the Scala Cookbook (http://shop.oreilly.com/product/0636920026914.do)
There is an example related to Future use that involves for comprehension.
So far my understanding about...
1
Solved
Been trying to figure out how I can access my data after I return it. This is a sample of x if I print it:
<_GatheringFuture finished result=[[{'ip': '173.245.203.70'}], [{'ip': '196.52.2.82'}]...
Salford asked 16/2, 2018 at 14:51
1
Solved
I'm trying to understand Future::select: in this example, the future with a longer time delay is returned first.
When I read this article with its example, I get cognitive dissonance. The author w...
3
Solved
I am a little bit confused by the std::async function.
The specification says:
asynchronous operation being executed "as if in a new thread of execution" (C++11 §30.6.8/11).
Now, what i...
Miyasawa asked 12/6, 2015 at 18:55
1
Solved
I have a class called Source, it has lazy val isValid which does some network checks that takes time. I've made it to return Future[Boolean] so it won't block main thread:
lazy val isValid: Future...
1
Solved
I am using a futures-rs powered version of the Rusoto AWS Kinesis library. I need to spawn a deep pipeline of AWS Kinesis requests to achieve high-throughput because Kinesis has a limit of 500 reco...
Outermost asked 15/1, 2018 at 16:54
1
Solved
I was wondering if it is ok to call promise.get_future(), move that future somewhere else (e.g. into a vector) and possibly let the promise die before even the future.get() is called. In the follow...
Cleric asked 23/1, 2018 at 18:16
2
Solved
We are developing some systems in our company in Scala and we have some doubts. We were discussing about how to map the future exceptions and we don't know when we should use the option 1 or the op...
Hunnish asked 12/4, 2016 at 22:1
1
I would like to know which ExecutionContext I should use (and why) on scalatest % 2.2.6 to run my futures and mock's futures.
class Foo {
def foo: Future[String] = Future.sucessful("B")
}
class ...
2
I am trying to call python functions which use pyspark rdd objects methods and are time-consuming which blocks my application.
I need to write it in an async fashion so that my app doesn't get bloc...
Frohne asked 17/1, 2018 at 13:18
1
In the official Spark RDD API:
https://spark.apache.org/docs/2.1.0/api/java/org/apache/spark/rdd/AsyncRDDActions.html
count, collect, foreach, and take all have async variants that return a Futur...
Smell asked 31/3, 2015 at 15:45
1
I'm encountering an issue where I have two methods, the first calling the second in a loop and the second creating a Future as follows:
public class WorkersCoordinator {
private static Logger LOG...
Gluten asked 14/12, 2017 at 1:16
2
Solved
I call a method that returns a Future, once for each element in a List<Principal>, so I end up with a List<Future<UserRecord>>.
The method returning Future is library code ...
Feathercut asked 14/12, 2017 at 6:11
5
Solved
Why does my unit test succeed in debug mode but fail when running it normally?
public class ExecutorServiceTest extends MockitoTestCase{
private int numThreads;
private ExecutorService pool;
p...
Ravens asked 2/3, 2013 at 0:18
3
Solved
To run some stuff in parallel or asynchronously I can use either an ExecutorService: <T> Future<T> submit(Runnable task, T result); or the CompletableFuture Api:static <U> Complet...
Graphemics asked 13/9, 2016 at 14:4
3
Solved
I am analysing the following code snippet and am trying to understand it in detail:
template<typename FUNCTION, typename... ARGUMENTS>
auto ThreadPool::add( FUNCTION&& Function, ARGU...
Placia asked 10/10, 2017 at 8:29
1
Solved
Is it possible to sleep inside a Future in Scala.js ?
Something like:
Future {
Thread.sleep(1000)
println("ready")
}
If I try this then I get an exception saying that sleep method does not ex...
3
I'm trying to understand the std::async, std::future system. What I don't quite understand is how you deal with running multiple async "tasks", and then, based on what returns first, second, etc, r...
Rebuild asked 24/8, 2017 at 2:56
4
I'm using Play Framework 2.1.1 with an external java library that produces a java.util.concurrent.Future result. I'm using the scala future's as opposed to Akka which I think is the right thing to ...
Stamen asked 20/6, 2013 at 13:51
2
Solved
I have wrote following code:
System.out.println("Main thread:" + Thread.currentThread().getId());
CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
try {
System.out...
Disepalous asked 4/9, 2017 at 8:17
4
I build a RDD from a list of urls, and then try to fetch datas with some async http call.
I need all the results before doing other calculs.
Ideally, I need to make the http calls on differents nod...
Nagle asked 9/3, 2016 at 18:36
1
Solved
I need to repeatedly call an asynchronous function in Dart, let's call it expensiveFunction, for a variable number of arguments. However, since each call is quite memory consuming, I cannot afford ...
2
Solved
In my project I need to poll some devices every n seconds and sleep and continue forever. I have created an async task with launch as async instead of std::thread. But if I use std::this_thread::sl...
Chenab asked 22/8, 2017 at 12:27
1
Solved
I'm playing with std::variant, lambdas and std::future, and got super weird results when I tried to compose them together. Here are examples:
using variant_t = std::variant<
std::function<s...
1
Solved
I understand what's std::future but i don't understand when and HOW to use std::shared_future and std::promise, and i couldn't find a good explanation online.
I will appreciate some help wrapping...
© 2022 - 2024 — McMap. All rights reserved.