Question about how we do injections
by Ron Sigal
I've been looking at an old issue, RESTEASY-1709 "Same JAX-RS Provider
instance injected across applications", which I thought I had solved by
injecting a javassist created proxy, but the reporter couldn't get it to
work so it's been sitting for almost a year.
Anyway, I've been trying to port the old code to master, and I see that
injection has changed to do a lot of stuff with CompletableFutures. In
particular, a series of injections into, say, a resource, becomes a
composition of CompletionStages, each one doing a single injection. I'm
trying to understand why.
One reason I can see is that, at least in the case of an asynchronous
invocation, you want to do as little as possible before returning a
CompletableFuture. That would provide better responsiveness. But I have
two questions:
1. Is constructing a CompletableFuture that much faster than just
doing the injection?
2. I don't how much space a CompletableFuture takes, but we've turned
a simple loop into a collection of CompletableFutures, which would seem
to occupy more space. Isn't that counterproductive in terms of our
general mandate to create a smaller footprint for container applications?
I'm not saying that the new code is wrong. I'm just saying that I don't
understand why it's right.
Any thoughts?
--
My company's smarter than your company (unless you work for Red Hat)
5 years, 10 months