This is homework.
I do not want a solution, just a small number of links or ideas.
Just saying what I want to do
A simple example:
public class Example { public void method() { int x = doThat();
doThat() is a method that is known to take a lot of time, which leads to blocking my program until the results return. And I want to use different methods of this object, but the program is frozen until doThat() is finished. These various methods need not be called from the method() used in this example, but possibly from outside the object.
I was thinking about using threads, but if I have a huge number of objects (1000+) it probably won't be very efficient (correct me if I am wrong, please). I think if I use threads, should I use one thread for each object?
Is there any other way besides threads that can cause the caller to not block when doThat(); called doThat(); ? If streaming is the only way, could you provide a link?
Knowing such questions, I get any downvotes. But please, just a link would be more than great.
Thanks in advance. Hope the question complies with the rules.
Muggen
source share