int wrote = mChannel.write(data);
int wrote = 0; try { wrote = mChannel.write(data); } catch (IOException ioe) { closeChannel(CloseReason.WRITE_FAILED); }
        private void processPendingWrites() throws IOException {        	synchronized (mLock) {        		int totalWritten = 0;        		boolean allWritten = true;        		for (Iterator<ByteBuffer> iter = mWriteBuffers.iterator(); iter.hasNext(); iter.remove()) {        			ByteBuffer data = iter.next();        			assert(data != null);        			assert(data.hasRemaining());        			                    String before = null;                    int req = 0;                    if (mDebug) before = OzUtil.toString(data);                     if (mDebug) req = data.remaining();                    if (mTrace) mLog.trace(OzUtil.byteBufferDebugDump("channel write buffer", data, false));                    int wrote = mChannel.write(data);        			                    totalWritten += wrote;                    if (mDebug) mLog.debug("channel wrote=" + wrote + " req=" + req + " partial=" + data.hasRemaining() + " total=" + totalWritten + " buffer: " + before + "->" + OzUtil.toString(data));                            			if (data.hasRemaining()) {        				// Not all data was written. Note that write interest is                        // enabled *elsewhere* when write is pending.        				allWritten = false;        				break;        			}        		}        		        		if (allWritten) {        			if (mCloseAfterWrite) {        				cleanupChannel(CleanupReason.NORMAL);        			}                            			synchronized (mLock) {        				mLock.notifyAll();        			}        		}                    	}        		        }