@Override
    public boolean isReady() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "isReady", this.listener);
        
        //If the listener is not set then we have no way to know if we can read in a non-blocking manner
        //return true so we don't accidentally block an app who doesn't set a listener but calls isReady
        if(this.listener == null || isFinished()){
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                Tr.exit(tc, "isReady", "ReadListener not set or isFinished returned true");
            return true;
        }
        boolean isReady = false;

        //Synchronize to ensure that no two methods can overlap in here as that could cause issue
        synchronized (this.lockObj){
            //If asyncReadOutstanding returns true, it means we don't need to do this check
            //If checkAvailable returns true then it means data is available right now
            //If it returns false it means we need to check if data is available immediately
            //If data is available immediately it will be populated and we return true
            //If not then we return false and an async read is in progress or we're finished
            if(!asyncReadOutstanding){
                if(!checkAvailable()){
                    isReady = this.httpin.asyncCheckBuffers(this.callback);
                    if(!isReady){
                        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                            Tr.debug(tc, "asyncCheckBuffers returned false. An async read is now outstanding or no more data");
                        }
                        this.asyncReadOutstanding = true;
                    }
                } else
                    isReady = true;
            }
        }
        
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "isReady", isReady + " " + this.listener);
        return isReady;
    }
@ Override public boolean isReady ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "isReady" , this . listener ) ; if ( this . listener == null || isFinished ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "isReady" , "ReadListener not set or isFinished returned true" ) ; return true ; } boolean isReady = false ; synchronized ( this . lockObj ) { if ( ! asyncReadOutstanding ) { if ( ! checkAvailable ( ) ) { isReady = this . httpin . asyncCheckBuffers ( this . callback ) ; if ( ! isReady ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "asyncCheckBuffers returned false. An async read is now outstanding or no more data" ) ; } this . asyncReadOutstanding = true ; } } else isReady = true ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "isReady" , isReady + " " + this . listener ) ; return isReady ; }
/* (non-Javadoc)
@see javax.servlet.ServletInputStream#isReady()