Hi all

In async mode servlet output stream write method receives a buffer and
copies it to _aggregate buffer or schedules write job. However in the
second case there is no way to detect if I can use the buffer again as
there is no async write task callback (except flush that is not an option
in fact). The other possible solution is to check isReady() after write
operation to get onWritePossible() callback every time but it looks
slightly weird and looks like this:

bufferLocked = true
if (stream.isReady) {
    stream.write(buffer, 0, size)
    if (stream.isReady) {
        // mark buffer is free and ready for reuse
        bufferLocked = false
    }
}

>From the specification it's not exactly clear what is a lifecycle of a
buffer provided to write method. Am I missing something?
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to