private void finish(boolean close) throws BadDescriptorException, IOException { try { flushWrite(); if (DEBUG) LOG.info("Descriptor for fileno {} closed by stream", descriptor.getFileno()); } finally { buffer = EMPTY_BUFFER; // clear runtime so it doesn't get stuck in memory (JRUBY-2933) runtime = null; // finish descriptor descriptor.finish(close); } }
/** * Close this descriptor. If in closing the last ChannelDescriptor reference to the associate * channel is closed, the channel itself will be closed. * * @throws org.jruby.util.io.BadDescriptorException if the associated channel is already closed * @throws java.io.IOException if there is an exception during IO */ public void close() throws BadDescriptorException, IOException { // tidy up finish(true); }