future Questions

1

Solved

What pattern should I use in this example to load and process some data. As value returns a value, it's not acceptable to have d as a Future. How can I get the constructor to wait until load has co...
Envelope asked 6/2, 2019 at 8:22

1

Solved

The following does not compile #![feature(await_macro, async_await, futures_api)] use core::future::Future; async fn foo() {} trait Bar { type Output: Future<Output = ()>; fn bar(&se...
Mattie asked 31/1, 2019 at 2:10

1

Solved

I have four Services. One will give hotels which is matching to the query. One will give City which is matching to the query. One will give Airports which is matching to the query. One will give M...

2

Solved

In (Java) reactive programming, what is the difference between a Future<T> and a (Project Reactor) Mono<T>? Both seem to be means for accessing the result of an asynchronous computation...
Jac asked 17/1, 2019 at 15:7

1

I am trying to run a function at the end of a delay if the timer is not canceled. The use case is a press and hold / double tap for user input. The main issue that I am having is that the tokio::r...
Sienese asked 20/1, 2019 at 19:10

2

Solved

I have this function: Future<String> load(SharedPreferences prefs, String fileName) async { prefs = await SharedPreferences.getInstance(); String jsonString = prefs.getString(fileName) ??...
Antonetta asked 16/10, 2018 at 8:55

5

Solved

I'm trying to explore all the options of the new C++11 standard in depth, while using std::async and reading its definition, I noticed 2 things, at least under Linux with gcc 4.8.1: It's called as...
Semifinal asked 31/7, 2013 at 6:30

2

I'm working on a problem where I have a List<ListenableFuture<T>>. I would like to aggregate the results of all of these futures into a List<T> with a timeout. The naive approach ...
Macswan asked 20/12, 2018 at 21:44

3

Solved

I sometimes find myself in a situation where I have some Stream[X], and a function X => Future Y, that I'd like to combine to a Future[Stream[Y]], and I can't seem to find a way to do it. For ex...
Dream asked 4/8, 2013 at 14:1

1

Solved

I try to cancel Future, but still getting the execution code in .then(). Why is it not working and what am I doing wrong? var c = CancelableOperation.fromFuture( Future.delayed(new Duration(secon...
Syphon asked 12/12, 2018 at 8:1

2

Solved

I have a utility method (used for unit testing, it so happens) that executes a Runnable in another thread. It starts the thread running, but does not wait for the Thread to finish, instead relying ...
Voltz asked 11/12, 2018 at 23:10

2

Solved

I'm building my first Flutter application and I've run into a bit of an async issue. When my application executes I'd like it to ask for permissions and wait until they are granted. My main() fun...
Cushy asked 5/12, 2018 at 12:15

1

Solved

I have an inputButton than when you click it, 2 querys to mysql database are done. One is a heavy one (more than 10 secs) and the other is light (less than 0.01sec to get data). As I want to show ...
Bedtime asked 21/11, 2018 at 7:17

5

Solved

I have two ListenableFutures which are completed on other threads. Each future is of a different type, and I wish to use both of their results when they are both complete. Is there an elegant way...
Compliance asked 7/12, 2012 at 12:49

2

Solved

I have a for loop which I am trying to parallelize using CompletableFuture. for (int i = 0; i < 10000; i++) { doSomething(); doSomethingElse(); } What I have till now is: for (int i = 0; i...

1

Solved

An answer to How do I read the entire body of a Tokio-based Hyper request? suggests: you may wish to establish some kind of cap on the number of bytes read [when using futures::Stream::concat2] ...
Nupercaine asked 4/11, 2018 at 15:46

2

Solved

Here we have SeqPar object which contains a task routine which is a simple mock Future which prints out some debugging info and returns Future[Int] type. The question is: why experiment1 is allow...
Inroad asked 4/11, 2018 at 10:46

11

Solved

I have a method that performs some task with a timeout. I use the ExecutorServer.submit() to get a Future object, and then I call future.get() with a timeout. This is working fine, but my question ...
Attire asked 3/5, 2012 at 19:14

1

Solved

I am trying to put together a framework to get Shiny working asynchronously on a set of classes I have, using futures and possibly promises. I have put together a test project using a set of extern...
Snuggery asked 19/10, 2018 at 8:35

1

Solved

I am rewriting tests that used to test an Akka actor that responded with a String, right now, we use a function that returns a Future[String]. So rewriting the tests using AsyncFunSuiteLike. Curre...
Derange asked 4/10, 2018 at 20:59

3

Is there a method in Akka (or in the standard library in Scala 2.10) to convert a Future[A] which might fail into a Future[Either[Exception,A]]? I know that you can write f.map(Right(_)).recover {...
Wearisome asked 5/1, 2013 at 4:50

2

Solved

I am in the process of writing a small scala wrapper around a java library. The java library has an object QueryExecutor exposing 2 methods: execute(query): Result asyncExecute(query): Listenab...
Joni asked 2/8, 2013 at 21:46

1

Solved

I have a slow future that blocks for 1 second before running to completion. I've tried to use the join combinator but the composite future my_app executes the futures sequentially: #![featu...
Njord asked 13/9, 2018 at 11:44

3

Solved

Okay, so I have a List of Files and I need to run a function on each member of the list. I essentially want to do something like this: for(File file in files) { functionThatReturnsAFuture(file); ...
Cusp asked 26/6, 2014 at 18:29

4

Solved

In the example below I get the exception java.util.NoSuchElementException: Future.filter predicate is not satisfied I want to have the result Future( Test2 ) when the check if( i == 2 ) fails. How...
Buttocks asked 25/7, 2013 at 22:7

© 2022 - 2024 — McMap. All rights reserved.