public synchronized void onWriteEvent() throws IOException {
  LRMIInvocationTrace trace=null;
  try {
    while (!_contexts.isEmpty()) {
      Context current=_contexts.peek();
      trace=current.getTrace();
      if (trace != null)       LRMIInvocationContext.updateContext(trace,null,null,null,null,false,null,null);
      noneBlockingWrite(current);
      if (current.getPhase() != Context.Phase.FINISH) {
        setWriteInterest();
        break;
      }
 else {
        traceContextTotalWriteTime(current);
        _contexts.poll();
        pendingWrites.decrement();
      }
    }
    if (_contexts.isEmpty()) {
      removeWriteInterest(true);
    }
  }
  finally {
    if (trace != null)     LRMIInvocationContext.resetContext();
  }
}

public synchronized void onWriteEvent ( ) throws IOException { LRMIInvocationTrace trace = null ; try { while ( ! _contexts . isEmpty ( ) ) { Context current = _contexts . peek ( ) ; trace = current . getTrace ( ) ; if ( trace != null ) LRMIInvocationContext . updateContext ( trace , null , null , null , null , false , null , null ) ; noneBlockingWrite ( current ) ; if ( current . getPhase ( ) != Context . Phase . FINISH ) { setWriteInterest ( ) ; break ; } else { traceContextTotalWriteTime ( current ) ; _contexts . poll ( ) ; pendingWrites . decrement ( ) ; } } if ( _contexts . isEmpty ( ) ) { removeWriteInterest ( true ) ; } } finally { if ( trace != null ) LRMIInvocationContext . resetContext ( ) ; } }
called from writeselectorthread to complete pending write requests . this is synchronized to ensure mutual exclusion with writebytestochannelnoneblocking method
