Structured Concurrency yet again
Attila Kelemen
attila.kelemen85 at gmail.com
Tue May 9 17:16:04 UTC 2023
Pedro Lamarão <pedro.lamarao at prodist.com.br> ezt írta (időpont: 2023.
máj. 9., K, 19:11):
>
> Em ter., 9 de mai. de 2023 às 13:35, Remi Forax <forax at univ-mlv.fr> escreveu:
>
>>
>> If we put everything together, we get the following code
>>
>> try(var scope = new AsyncScope<Integer, RuntimeException>()) {
>> AsyncTask<Integer, RuntimeException> task = scope.async(() -> {
>> Thread.sleep(100);
>> return 10;
>> });
>> var task2 = scope.async(() -> {
>> Thread.sleep(300);
>> return 30;
>> });
>
>
>
> How would we use AsyncScope to concurrently call two services which return different data types?
>
Previously the scope took a generic parameter "T", and then the fork
call returned <R extends T>, so you could declare T to be Object, and
then do whatever.
More information about the loom-dev
mailing list