docs: @Override
      public void setWriteListener(WriteListener appWLObject) {
  
          if(appWLObject == null){  
              Tr.error(tc, "writelistener.is.null");  
              throw new NullPointerException(Tr.formatMessage(tc, "writelistener.is.null"));
          }
          
          if(this.isOutputStreamNBClosed()){
              Tr.error(tc, "stream.is.closed.no.read.write");                         
              throw new IllegalStateException(Tr.formatMessage(tc, "stream.is.closed.no.read.write"));           
          }
  
          if(!this.reqImpl.isStartAsync()){               
              Tr.error(tc, "writelistener.async.not.started");  
              throw new IllegalStateException(Tr.formatMessage(tc, "writelistener.async.not.started"));
          } 
  
          //Throw an IllegalStateException is there was already a WriteListener set for this InputStream
          if(this._listener != null){           
              Tr.error(tc, "writelistener.already.started");                         
              throw new IllegalStateException(Tr.formatMessage(tc, "writelistener.already.started"));
          }                                  
  
          this._listener = appWLObject;
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())  {  
              Tr.debug(tc, "set WriteListener enabled: " + this._listener);
          }
  
          //Create a new thread manager to pass into the callback and into the runnable
          ThreadContextManager tcm = new ThreadContextManager();
          //Create a new Callback so we can use it for our async write callbacks
          this._callback = new AsyncWriteCallback(this._listener, this, _httpOut, tcm);            
  
          //tell the outputStream that WriteListener has been set by application
          this._httpOut.setAsyncServletWriteListenerCallBack(_callback);    
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() && this.output.hasBufferedContent()){  
              Tr.debug(tc, "stream has data before start write listener first time");
          }                                      
          //Creates the runnable to run the setWriteListener on a new thread
          WriteListenerRunnable wlRunnable = new WriteListenerRunnable(this._listener, _httpOut, _callback, tcm);
          
          // make sure no more write allowed on this Thread as this set WL.
          WebContainerRequestState reqState = WebContainerRequestState.getInstance(true);  
  //        reqState.setAttribute("com.ibm.ws.webcontainer.ThisThreadSetWL", true);
          if (reqState.getAttribute("com.ibm.ws.webcontainer.WriteAllowedonThisThread")!=null){
              reqState.removeAttribute("com.ibm.ws.webcontainer.WriteAllowedonThisThread");               
          }
          try {
              com.ibm.ws.webcontainer.osgi.WebContainer.getExecutorService().execute(wlRunnable);
          } catch (Exception e) {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){  
                  Tr.debug(tc, "An exception occurred during the execute , onWritePossible may not be called: " + e.toString());
              }
              this._listener.onError(e);           
          }      
      }