On Mon, 5 Oct 2020 09:40:14 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:
>> src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java >> line 569: >> >>> 567: this.bodies = new ConcurrentLinkedQueue<>(bodies); >>> 568: this.subscriber = subscriber; >>> 569: scheduler = >>> SequentialScheduler.synchronizedScheduler(this::run); >> >> It's a little unpleasant that this call to the scheduler is inside the >> constructor. I wonder if it could be located in >> the subscribe method above, just after the subscription is created? (since >> both classes are in the same nest ) > > Scheduler is a final variable in `AggregateSubscription`. Fixed to: > > ` this.scheduler = ....;` > > (though the `this.` is not strictly needed in this third instantiation) Daniel, I believe Chris' concern is the escape of `this` before the (`AggregateSubscription`) object is fully constructed. ------------- PR: https://git.openjdk.java.net/jdk/pull/57