Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
-1 votes
1 answer
351 views

Need help for CompletableFuture or Callable Future

I am facing issue for finding out which will be the best way for my below scenario. I wanted to call 1 API by using multiple threads at a time and wanted to merge their response to make a list. First ...
mohan's user avatar
  • 457
0 votes
0 answers
193 views

Java - read a file using executor service gives error 409

How to read same file twice, in different tasks using executor service? I used below sample code structure, but while reading same file simultaneously gives 409 error. How to resolve it? //Sample ...
user avatar
2 votes
1 answer
1k views

Using Callable instead of Supplier or vice versa

I came across code that used Callable instead of Supplier. I did not see any threads spawning across to use Callable. But is it okay to use Callable instead of Supplier?. One of the devs I work with ...
serah's user avatar
  • 2,107
0 votes
2 answers
2k views

Java 8 Deferring Execution of Method

I have a class hierarchy like this: public abstract class AbstractFoo { abstractMethod(/*parameters*/) { //do something; } } public class Foo extends AbstractFoo { public String ...
Richard's user avatar
  • 6,088
1 vote
0 answers
3k views

org.awaitility.Awaitility.await() is never triggered

I saw this post on how to use org.awaitility.await() I have this code: public void bar() { await().forever().pollInterval(5, SECONDS).until(foo()); } private Callable<Boolean> foo() { ...
Elad Benda's user avatar
  • 36.6k
5 votes
2 answers
185 views

Make a Method Which Generates the x and y values of Another Given Function

I have just started to learn about Java Runnables and I have heard of Callables. However, I am very much struggling with this problem. I would like to make a method which takes a function as an ...
Dylan Siegler's user avatar
1 vote
0 answers
949 views

ExecutorService asynchronous never end the main method

I've to do a massive upload to a certain server - my program do each upload in about 1 second - but i will upload around 10 thousand documents each time. To do this, i thought in use parallelism to ...
Raduan Santos's user avatar
8 votes
1 answer
5k views

Java 8 Function<String, Void> vs Consumer<String> [duplicate]

I can't for the life of me find an explanation of the following: public static void takesAFunction(Function<String, Void> func) { func.apply("Hi I'm running a function"); } public static ...
RVP's user avatar
  • 2,400
11 votes
1 answer
16k views

Callable<Void> as Functional Interface with lambdas

I am just learning about new java8 features. And here is my question: Why is it not allowed to use Callable<Void> as a functional interface for lambda expressions? (Compiler complains about ...
ferrerverck's user avatar