On 12 September 2013 06:48, Richard Johnson <[email protected]>wrote:
> > but it is unclear how much data can be written without blocking. > > If isReady() returns true, you can write as much data as you like in a single write call and it will not block. I think some impls achieve this by copying the data (Yuck OOME here we come!!!), but jetty just keeps a reference to the passed byte array and essentially owns it until the write is complete (signalled with a callback or subsequent isReady()==true). > I.e. if we do large enough write in subsequent out.writ(buffer, 0, len), > it would block? Or not? > If a subsequent write occurs whilst the previous one is not complete, then you will get a PendingWriteException. Actually you might even get that if you do a write without calling isReady(). Spec is indeed unclear on this point and there was talk about going to autoblocking mode if a write was done without calling isReady().... but then there is no way of knowing when you can do that write and avoid a WritePendingException unless you call isReady(), in which case you are async. Short story is that you must call isReady() before any subsequent writes after an onWritePossible callback. -- Greg Wilkins <[email protected]> http://www.webtide.com Developer advice and support from the Jetty & CometD experts. Intalio, the modern way to build business applications.
_______________________________________________ jetty-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/jetty-users
