private boolean maybeFinish ( ) { // Check for cancellations Throwable localError = this . cancellation . get ( ) ; if ( localError != null ) { finished = true ; outerResponseObserver . onError ( localError ) ; return true ; } // Check for upstream termination and exhaustion of local buffers if ( done && ! reframer . hasFullFrame ( ) && ! awaitingInner ) { finished = true ; if ( error != null ) { outerResponseObserver . onError ( error ) ; } else if ( reframer . hasPartialFrame ( ) ) { outerResponseObserver . onError ( new IncompleteStreamException ( ) ) ; } else { outerResponseObserver . onComplete ( ) ; } return true ; } // No termination conditions found, go back to business as usual return false ; }
Completes the outer observer if appropriate .