Closes the buffer if this {@code exception} is not
{@code null}. Recycles all elements of the buffer and
sets {@code elements}, {@code put} and {@code take} to
{@code null}.

@param e exception that is used to close buffer with
199808
@Override
	public void close(@NotNull Throwable e) {
		if (exception != null) return;
		exception = e instanceof Exception ? (Exception) e : new RuntimeException(e);
		if (put != null) {
			put.setException(e);
			put = null;
		}
		if (take != null) {
			take.setException(e);
			take = null;
		}
		for (int i = head; i != tail; i = (i + 1) & (elements.length - 1)) {
			tryRecycle(elements[i]);
		}
		//noinspection AssignmentToNull - resource release
		elements = null;
	}
792909
public synchronized void transferError(Exception e) {
	logger.debug("intercepted exception", e);
	if (transferException == null) {
	    transferException = e;
	} else if (transferException instanceof InterruptedException
		   || transferException instanceof InterruptedIOException) {
	    //if one of the threads throws an error, it interrupts
	    //the other thread (by InterruptedException).
	    //Here we make sure that transferException will store the
	    //primary failure reason, not the resulting InterruptedException
	    transferException = e;
	}
	notifyAll();
    }
457280
@Override
    public void close() throws IOException {
        final List<IOException> exceptionList = new ArrayList<>();
        for (final Node node : nodeList) {
            try {
                node.close();
            } catch (final IOException e) {
                exceptionList.add(e);
            }
        }
        if (exceptionList.isEmpty()) {
            print("Closed all nodes.");
        } else {
            if (useLogger && logger.isDebugEnabled()) {
                for (final Exception e : exceptionList) {
                    logger.debug("Failed to close a node.", e);
                }
            }
            throw new IOException(exceptionList.toString());
        }
    }
1176705
public void destroy(Exception e) {
        if (this.appCallback != null) {
            this.appCallback.destroy(e);
            this.appCallback = null;
        }
    }
397463
public void destroy(Exception e) {

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Destroying this outbound link: " + this + " " + getVirtualConnection());
        }
        // if this object is not active, then just return out
        if (!this.reconnecting) {
            synchronized (this) {
                if (!this.bIsActive) {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Ignoring destroy on an inactive object");
                    }
                    return;
                }
                this.bIsActive = false;
            }
            super.destroy(e);
            if (null != this.myInterface) {
                this.myInterface.destroy();
                this.myInterface = null;
            }
            // 342859 - disconnect from these objects too
            this.targetAddress = null;
            this.myChannel = null;
        } else {
            // this connection is now toast...need to tell that to the
            // channel above.
            this.earlyReconnectDestroy = true;
            IOException ioe = this.reconnectException;
            this.reconnectException = null;
            this.reconnecting = false;
            this.myInterface.callErrorCallback(getVirtualConnection(), ioe);
        }
    }
609851
public void setText(Exception e) {
		StringWriter wr = new StringWriter();
		PrintWriter pr = new PrintWriter(wr);
		e.printStackTrace(pr);
		this.setText(wr.toString());
	}
948057
@Override
	public void recycle(MemorySegment segment) {
		int numAddedBuffers;

		synchronized (bufferQueue) {
			// Similar to notifyBufferAvailable(), make sure that we never add a buffer
			// after releaseAllResources() released all buffers (see below for details).
			if (isReleased.get()) {
				try {
					inputGate.returnExclusiveSegments(Collections.singletonList(segment));
					return;
				} catch (Throwable t) {
					ExceptionUtils.rethrow(t);
				}
			}
			numAddedBuffers = bufferQueue.addExclusiveBuffer(new NetworkBuffer(segment, this), numRequiredBuffers);
		}

		if (numAddedBuffers > 0 && unannouncedCredit.getAndAdd(numAddedBuffers) == 0) {
			notifyCreditAvailable();
		}
	}
50062
public synchronized void close()
	{
		if (s != null) {
			super.close();
			try {
				s.close();
			}
			catch (final IOException e) {}
			s = null;
		}
	}
25883
protected static StringBuilder handleExceptionStart(Exception e) {
        LOG.warning(ExceptionUtils.getStackTrace(e));
        StringBuilder sb = new StringBuilder();
        if (e.getMessage() != null) {
            sb.append(e.getMessage()).append(". ");
        }
        if (e.getCause() != null && e.getCause().getMessage() != null) {
            sb.append(e.getCause().getMessage()).append(". ");
        }
        return sb;
    }
479263
private void exception(Throwable e)
    {
        try
        {
            _persistent=false;
            int error_code=HttpResponse.__500_Internal_Server_Error;
            
            if (e instanceof HttpException)
            {
                error_code=((HttpException)e).getCode();
                
                if (_request==null)
                    log.warn(e.toString());
                else
                    log.warn(_request.getRequestLine()+" "+e.toString());
                log.debug(LogSupport.EXCEPTION,e);
            }
            else if (e instanceof EOFException)
            {
                LogSupport.ignore(log,e);
                return;
            }
            else
            {
                _request.setAttribute("javax.servlet.error.exception_type",e.getClass());
                _request.setAttribute("javax.servlet.error.exception",e);
                
                if (_request==null)
                    log.warn(LogSupport.EXCEPTION,e);
                else
                    log.warn(_request.getRequestLine(),e);
            }
            
            if (_response != null && !_response.isCommitted())
            {
                _response.reset();
                _response.removeField(HttpFields.__TransferEncoding);
                _response.setField(HttpFields.__Connection,HttpFields.__Close);
                _response.sendError(error_code);
            }
        }
        catch(Exception ex)
        {
            LogSupport.ignore(log,ex);
        }
    }
316644
@Override
	public void setException(@NotNull Throwable e) {
		assert !isComplete();
		exception = e;
		completeExceptionally(e);
	}
1117909
public void put(E e) throws InterruptedException {
        if (e == null) throw new NullPointerException();
        if (transferer.transfer(e, false, 0) == null) {
            Thread.interrupted();
            throw new InterruptedException();
        }
    }
429259
@Override
    public void release() throws EEException {
        LOG.trace("Releasing Execution Engine... " + pointer);
        if (pointer != 0L) {
            final int errorCode = nativeDestroy(pointer);
            pointer = 0L;
            checkErrorCode(errorCode);
        }
        m_firstDeserializer = null;
        m_firstDeserializerBufferOrigin.discard();
        m_nextDeserializer = null;
        m_nextDeserializerBufferOrigin.discard();
        m_exceptionBuffer = null;
        m_exceptionBufferOrigin.discard();
        m_emptyDeserializer = null;
        m_emptyDeserializerBuffer.discard();
        m_psetBufferC.discard();
        m_psetBuffer = null;
        m_perFragmentStatsBufferC.discard();
        m_perFragmentStatsBuffer = null;
        m_udfBufferC.discard();
        m_udfBuffer = null;
        LOG.trace("Released Execution Engine.");
    }
633601
@Override
  public void putAllFailure(Map<? extends K, ? extends V> entries, StoreAccessException e) {
    cleanup(entries.keySet(), e);
  }
1130777
@SuppressWarnings("unchecked")
    public E take() throws InterruptedException
    {
        final E[] buffer = consumerBuffer;
        final long mask = consumerMask;
        
        final long cIndex = lpConsumerIndex();
        final long offset = modifiedCalcElementOffset(cIndex, mask);
        Object e = lvElement(buffer, offset);// LoadLoad
        if (e == null)
        {
            long pIndex = lvProducerIndex();
            if (cIndex == pIndex && casProducerIndex(pIndex, pIndex + 1))
            {
                // producers only try a wakeup when both the index and the blocked thread are visible
                soBlocked(Thread.currentThread());
                do
                {
                    LockSupport.park();
                    if (Thread.currentThread().isInterrupted())
                    {
                        throw new InterruptedException();
                    }
                }
                while (lvBlocked() != null);
            }
            // producer index is visible before element, so if we wake up between the index moving and the element
            // store we could see a null.
            e = spinWaitForElement(buffer, offset);
        }

        soElement(buffer, offset, null); // release element null
        soConsumerIndex(cIndex + 2); // release cIndex
        
        return (E) e;
    }
513626
public final void write(Throwable e) throws IOException {
    indent();
    newLine();

    write(e.toString());

    StackTraceElement[] elements = e.getStackTrace();
    for (int i = 0; i < elements.length; i++) {
      newLine();
      write(elements[i].toString());
    }

    Throwable cause = e.getCause();
    if (cause != null) {
      newLine();
      write(cause.toString());
    }

    outdent();
  }
1097867
@Override
  public void close() throws IOException {
    if (inputStream != null) {
      inputStream.close();
      inputStream = null;
    }

    if (buffer != null) {
      buffer = null;
    }
  }