Hi guys,

AsyncCollector.collect(Throwable) method  seem to  not release  the Thread.
This scenario may be problematic when calling an external API
In the case of a timeout error there is no data to collect.

for example :

  CompletableFuture.supplyAsync(() -> asyncCallTask(input))
            .thenAccept((Collection<Tuple3<String, streamDTO,
Integer>> result) -> {

                this.tupleEmited.getAndIncrement();

                asyncCollector.collect(result);
            })
            .exceptionally((ex) -> {
                asyncCollector.collect(ex);
                return null;
            });
}

it is possible to create an empty Collection and collect this empty
collection to force the Thread to be released but this workflow seems
strange to me.
thank for your help


-- 
Steve Robert <https://www.linkedin.com/company/qualys>
Software Engineer
srob...@qualys.com
T
Qualys, Inc. – Continuous Security
Blog <https://qualys.com/blog> | Community <https://community.qualys.com> |
Twitter <https://twitter.com/qualys>
<https://www.qualys.com/email-banner>

Reply via email to