public void run() { try { os.write(buf); } catch (IOException e) { try { if (channel.remoteCapability.supportsProxyWriter2_35()) channel.send(new NotifyDeadWriter(channel, e, oid)); } catch (ChannelClosedException x) { // the other direction can be already closed if the connection // shut down is initiated from this side. In that case, remain silent. } catch (IOException x) { // ignore errors LOGGER.log(Level.WARNING, "Failed to notify the sender that the write end is dead", x); LOGGER.log(Level.WARNING, "... the failed write was:", e); } } finally { if (channel.remoteCapability.supportsProxyWriter2_35()) { try { channel.send(new Ack(oid, buf.length)); } catch (ChannelClosedException x) { // the other direction can be already closed if the connection // shut down is initiated from this side. In that case, remain silent. } catch (IOException e) { // ignore errors LOGGER.log(Level.WARNING, "Failed to ack the stream", e); } } } } });
public synchronized void flush() throws IOException { if(channel!=null && channel.remoteCapability.supportsProxyWriter2_35()) channel.send(new Flush(channel.newIoId(),oid)); }
@Override //TODO: really? @SuppressFBWarnings(value = "FI_FINALIZER_NULLS_FIELDS", justification = "As designed") protected synchronized void finalize() throws Throwable { super.finalize(); // if we haven't done so, release the exported object on the remote side. // if the object is auto-unexported, the export entry could have already been removed. if(channel!=null) { if (channel.remoteCapability.supportsProxyWriter2_35()) channel.send(new Unexport(channel.newIoId(),oid)); else channel.send(new EOF(channel.newIoId(),oid)); channel = null; oid = -1; } }