@FFDCIgnore({ IOException.class })
    private void flushAsyncBuffers() throws IOException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Flushing Async buffers: " + this);
        }
        if (!this.isc.getResponse().isCommitted()) {
            if ((obs != null) && !this.WCheadersWritten) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "obs  ->" + obs);
                }
                obs.alertOSFirstFlush();
            }

            this.isc.getResponse().setCommitted();
        }

        if (this.ignoreFlush) {
            this.ignoreFlush = false;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Ignoring first flush attempt");
            }
            return;
        }

        final boolean writingBody = (hasBufferedContent());
        // flip the last buffer for the write...
        if (writingBody && null != this.output[this.outputIndex]) {
            this.output[this.outputIndex].flip();
        }
        try {
            WsByteBuffer[] content = (writingBody) ? this.output : null;
            if (isClosed() || this.isClosing) {
                if (!hasFinished) { //if we've already called finishResponseMessage - don't call again
                    // on a closed stream, use the final write api
                    this.isc.finishResponseMessage(content); // check if this also needs to be async
                    this.isClosing = false;
                    this.hasFinished = true;
                }
            } else {
                // else use the partial body api
                // Add the async option.               
                vc = this.isc.sendResponseBody(content, _callback, false);
                if (vc == null) { // then we will have to wait for data to be written, async write in progress
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "wait for data to be written, async write in progress, set ready to false");
                    }
                    synchronized (this._writeReadyLockObj) {
                        this.setWriteReady(false);
                        this.set_internalReady(false);
                    }
                }
                else {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "able to write out, no callback required, vc -->" + vc);
                    }
                }
            }
        } catch (MessageSentException mse) {
            FFDCFilter.processException(mse, getClass().getName(),
                                        "flushAsyncBuffers", new Object[] { this, this.isc });
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Invalid state, message-sent-exception received; " + this.isc);
            }
            this.error = new IOException("Invalid state");
            throw this.error;
        } catch (IOException ioe) {
            // no FFDC required
            this.error = ioe;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Received exception during write: " + ioe);
            }
            throw ioe;
        } finally {
            this.bytesWritten += this.bufferedCount;
            if (this.contentLengthSet) {
                this.bytesRemaining -= this.bufferedCount;
            }
            this.bufferedCount = 0;
            this.outputIndex = 0;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "finally, this " + this + " ,bytesRemaining -->" + this.bytesRemaining + ", bytesWritten -->" + this.bytesWritten);
            }
            if (writingBody && vc != null) {
                clearBuffersAfterWrite();
            }
        }
    }
@ FFDCIgnore ( { IOException . class } ) private void flushAsyncBuffers ( ) throws IOException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Flushing Async buffers: " + this ) ; } if ( ! this . isc . getResponse ( ) . isCommitted ( ) ) { if ( ( obs != null ) && ! this . WCheadersWritten ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "obs  ->" + obs ) ; } obs . alertOSFirstFlush ( ) ; } this . isc . getResponse ( ) . setCommitted ( ) ; } if ( this . ignoreFlush ) { this . ignoreFlush = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Ignoring first flush attempt" ) ; } return ; } final boolean writingBody = ( hasBufferedContent ( ) ) ; if ( writingBody && null != this . output [ this . outputIndex ] ) { this . output [ this . outputIndex ] . flip ( ) ; } try { WsByteBuffer [ ] content = ( writingBody ) ? this . output : null ; if ( isClosed ( ) || this . isClosing ) { if ( ! hasFinished ) { this . isc . finishResponseMessage ( content ) ; this . isClosing = false ; this . hasFinished = true ; } } else { vc = this . isc . sendResponseBody ( content , _callback , false ) ; if ( vc == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "wait for data to be written, async write in progress, set ready to false" ) ; } synchronized ( this . _writeReadyLockObj ) { this . setWriteReady ( false ) ; this . set_internalReady ( false ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "able to write out, no callback required, vc -->" + vc ) ; } } } } catch ( MessageSentException mse ) { FFDCFilter . processException ( mse , getClass ( ) . getName ( ) , "flushAsyncBuffers" , new Object [ ] { this , this . isc } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Invalid state, message-sent-exception received; " + this . isc ) ; } this . error = new IOException ( "Invalid state" ) ; throw this . error ; } catch ( IOException ioe ) { this . error = ioe ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Received exception during write: " + ioe ) ; } throw ioe ; } finally { this . bytesWritten += this . bufferedCount ; if ( this . contentLengthSet ) { this . bytesRemaining -= this . bufferedCount ; } this . bufferedCount = 0 ; this . outputIndex = 0 ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "finally, this " + this + " ,bytesRemaining -->" + this . bytesRemaining + ", bytesWritten -->" + this . bytesWritten ) ; } if ( writingBody && vc != null ) { clearBuffersAfterWrite ( ) ; } } }
Flush the output array of buffers to the network below.

@throws IOException