@Override public void releaseResources() { final AsyncEntityProducer producer = entityProducerRef.getAndSet(null); if (producer != null) { producer.releaseResources(); } }
@Override public void releaseResources() { entityConsumer.releaseResources(); final AsyncEntityProducer producer = entityProducerRef.getAndSet(null); if (producer != null) { producer.releaseResources(); } }
@Override public void releaseResources() { if (responseContentProducer != null) { responseContentProducer.releaseResources(); } }
@Override public void releaseResources() { if (dataProducer != null) { dataProducer.releaseResources(); } } }
@Override public void releaseResources() { if (dataProducer != null) { dataProducer.releaseResources(); } } }
@Override public void releaseResources() { if (entityProducer != null) { entityProducer.releaseResources(); } }
@Override public void releaseResources() { if (responseContentProducer != null) { responseContentProducer.releaseResources(); } }
@Override public void releaseResources() { if (entityProducer != null) { entityProducer.releaseResources(); } }
@Override public void releaseResources() { if (dataProducer != null) { dataProducer.releaseResources(); } }
@Override public void releaseResources() { wrapped.releaseResources(); }
@Override public void releaseResources() { if (dataProducer != null) { dataProducer.releaseResources(); } }
@Override public void releaseResources() { if (dataProducer != null) { dataProducer.releaseResources(); } }
@Override public void releaseResources() { if (dataProducer != null) { dataProducer.releaseResources(); } }
@Override public void releaseResources() { wrapped.releaseResources(); }
scope.execRuntime.discardEndpoint(); if (entityProducer != null) { entityProducer.releaseResources();
entityProducer.releaseResources();
@Test public void testTextContentRepeatable() throws Exception { final AsyncEntityProducer producer = new StringAsyncEntityProducer( "abc", ContentType.TEXT_PLAIN); Assert.assertEquals(-1, producer.getContentLength()); Assert.assertEquals(ContentType.TEXT_PLAIN.toString(), producer.getContentType()); Assert.assertEquals(null, producer.getContentEncoding()); for (int i = 0; i < 3; i++) { final WritableByteChannelMock byteChannel = new WritableByteChannelMock(1024); final DataStreamChannel streamChannel = new BasicDataStreamChannel(byteChannel); producer.produce(streamChannel); Assert.assertFalse(byteChannel.isOpen()); Assert.assertEquals("abc", byteChannel.dump(StandardCharsets.US_ASCII)); producer.releaseResources(); } }
@Test public void testTextContentRepeatable() throws Exception { final AsyncEntityProducer producer = new BasicAsyncEntityProducer( "abc", ContentType.TEXT_PLAIN); Assert.assertEquals(3, producer.getContentLength()); Assert.assertEquals(ContentType.TEXT_PLAIN.toString(), producer.getContentType()); Assert.assertEquals(null, producer.getContentEncoding()); for (int i = 0; i < 3; i++) { final WritableByteChannelMock byteChannel = new WritableByteChannelMock(1024); final DataStreamChannel streamChannel = new BasicDataStreamChannel(byteChannel); producer.produce(streamChannel); Assert.assertFalse(byteChannel.isOpen()); Assert.assertEquals("abc", byteChannel.dump(StandardCharsets.US_ASCII)); producer.releaseResources(); } }
@Test public void testTextContentRepeatable() throws Exception { final AsyncEntityProducer producer = new FileEntityProducer(tempFile, ContentType.TEXT_PLAIN); Assert.assertEquals(6, producer.getContentLength()); Assert.assertEquals(ContentType.TEXT_PLAIN.toString(), producer.getContentType()); Assert.assertEquals(null, producer.getContentEncoding()); for (int i = 0; i < 3; i++) { final WritableByteChannelMock byteChannel = new WritableByteChannelMock(1024); final DataStreamChannel streamChannel = new BasicDataStreamChannel(byteChannel); producer.produce(streamChannel); producer.produce(streamChannel); Assert.assertFalse(byteChannel.isOpen()); Assert.assertEquals("abcdef", byteChannel.dump(StandardCharsets.US_ASCII)); producer.releaseResources(); } }