tracing-java icon indicating copy to clipboard operation
tracing-java copied to clipboard

Tracing-aware functions, bifunctions, suppliers, consumers, biconsumers

Open mattsills opened this issue 7 years ago • 4 comments

mattsills avatar Oct 01 '18 14:10 mattsills

Out of curiosity, can you paste a code snippet that you're intending to use these new Tracers.wrap methods?

iamdanfox avatar Oct 01 '18 14:10 iamdanfox

@iamdanfox anything involving chaining futures.

CompletableFuture.supplyAsync(..., executor).thenApply(res -> ...);
CompletableFuture.supplyAsync(..., executor).thenApply(trace(res -> ...));

mattsills avatar Oct 26 '18 09:10 mattsills

This won't actually work if you try to create a Supplier.

For example, this code:

Callable<Integer> callable = Tracers.wrap(() -> 42);
Supplier<Integer> supplier = Tracers.wrap(() -> 42);

will fail with the following errors:

reference to wrap is ambiguous

incompatible types: no instance(s) of type variable(s) V exist so that Callable<V> conforms to Supplier<Integer>

pkoenig10 avatar Dec 20 '18 23:12 pkoenig10

@mattsills do you still need this? Also, @pkoenig10 raised a point that this breaks, can you comment on whether that's the case or not?

dansanduleac avatar Nov 12 '19 17:11 dansanduleac