@Test void onClosedChannel() throws Exception { PeriodicalChannel pc = new PeriodicalChannel(i -> 1024, TEST_DATA_SIZE); pc.close(); ReadableByteChannelPublisher publisher = new ReadableByteChannelPublisher(pc, RetrySchema.constant(0)); try { ContentReaders.readBytes(publisher).get(5, TimeUnit.SECONDS); fail("Did not throw expected ExecutionException!"); } catch (ExecutionException e) { assertThat(e.getCause(), instanceOf(ClosedChannelException.class)); } LazyValue<ScheduledExecutorService> executor = publisher.executor(); assertThat("Executor should have not been used", executor.isLoaded(), is(false)); }
LazyValue<ScheduledExecutorService> executor() { return executor; }
ReadableByteChannelPublisher implements Flow.Publisher<DataChunk> { LazyValue<ScheduledExecutorService> executor() { return executor; } }
ReadableByteChannelPublisher implements Flow.Publisher<DataChunk> { LazyValue<ScheduledExecutorService> executor() { return executor; } @Deprecated(since = "2.0.0", forRemoval = true)  ReadableByteChannelPublisher(ReadableByteChannel channel, RetrySchema retrySchema); }
ReadableByteChannelPublisher implements Flow.Publisher<DataChunk> { LazyValue<ScheduledExecutorService> executor() { return executor; } @Deprecated(since = "2.0.0", forRemoval = true)  ReadableByteChannelPublisher(ReadableByteChannel channel, RetrySchema retrySchema); @Override void subscribe(Flow.Subscriber<? super DataChunk> subscriberParam); }
ReadableByteChannelPublisher implements Flow.Publisher<DataChunk> { LazyValue<ScheduledExecutorService> executor() { return executor; } @Deprecated(since = "2.0.0", forRemoval = true)  ReadableByteChannelPublisher(ReadableByteChannel channel, RetrySchema retrySchema); @Override void subscribe(Flow.Subscriber<? super DataChunk> subscriberParam);  }