org.xnio.conduits.BufferedStreamSinkConduit is probably a good example, although it does
not use writeFinal().
Stuart
----- Original Message -----
From: "Stuart Douglas" <sdouglas(a)redhat.com>
To: "Jeff Williams" <jeffw(a)wherethebitsroam.com>
Cc: undertow-dev(a)lists.jboss.org
Sent: Tuesday, 4 November, 2014 7:10:53 AM
Subject: Re: [undertow-dev] AbstractFixedLengthStreamSinkConduit
You need to not pass on the terminateWrites() call to the delegate until your
have written all your data.
Once terminateWrites is called on your channel set some kind of boolean flag
to indicate that this is shutdown, and then when the user calls flush()
write out the buffer (using writeFinal for best performance). If you are not
using writeFinal() then you need to call terminateWrites() once you succeed
in flushing, and then pass further flush calls to the delegate.
Stuart
----- Original Message -----
> From: "Jeff Williams" <jeffw(a)wherethebitsroam.com>
> To: undertow-dev(a)lists.jboss.org
> Sent: Monday, 3 November, 2014 11:48:10 PM
> Subject: [undertow-dev] AbstractFixedLengthStreamSinkConduit
>
> Hi,
>
> I have written a StreamSinkConduit which buffers content in a pooled
> buffer.
> I am having an issue with AbstractFixedLengthStreamSinkConduit throwing a
> FixedLengthUnderflowException exception.
>
> If I have content left in my buffer which I have not yet been able to write
> to the next conduit when terminateWrites is called, the exception is
> thrown.
> Even though this content would have been written in the subsequent call to
> flush. Shouldn't the bytes remaining be checked after a successful flush
> rather than in terminateWrites? Or am I missing something?
>
> For the time being I am flushing my local buffer in terminateWrites, but
> this
> seems wrong!
>
> Jeff
>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/undertow-dev