On Mon, 13 Jan 2025 19:20:41 GMT, He-Pin(kerr) <d...@openjdk.org> wrote:
>> Backport to jdk24 of https://bugs.openjdk.org/browse/JDK-8347274 > > Does this fix the OOM problem? > > > import java.util.stream.Gatherers; > import java.util.stream.IntStream; > > /** > * TODO: description of this file > * > * @author 虎鸣 > */ > public class Main { > public static void main(String[] args) { > final var stream = IntStream.range(0, Integer.MAX_VALUE); > stream.boxed() > .gather(Gatherers.mapConcurrent( > 2, > i -> { > if (i == 0) { > try { > Thread.sleep(Integer.MAX_VALUE); > } catch (InterruptedException e) { > throw new RuntimeException(e); > } > } > return i; > })) > .forEach(System.out::println); > try { > Thread.sleep(Integer.MAX_VALUE); > } catch (InterruptedException e) { > throw new RuntimeException(e); > } > } > } @He-Pin I believe it will, yes. ------------- PR Comment: https://git.openjdk.org/jdk/pull/23068#issuecomment-2589614630