public final synchronized void close(AionServerPacket closePacket,boolean forced){
  if (isWriteDisabled()) {
    return;
  }
  log.info("sending packet: " + closePacket + " and closing connection after that.");
  pendingClose=true;
  isForcedClosing=forced;
  sendMsgQueue.clear();
  sendMsgQueue.addLast(closePacket);
  enableWriteInterest();
}

public final synchronized void close ( AionServerPacket closePacket , boolean forced ) { if ( isWriteDisabled ( ) ) { return ; } log . info ( "sending packet: " + closePacket + " and closing connection after that." ) ; pendingClose = true ; isForcedClosing = forced ; sendMsgQueue . clear ( ) ; sendMsgQueue . addLast ( closePacket ) ; enableWriteInterest ( ) ; }
its guaranted that closepacket will be sent before closing connection , but all past and future packets wont . connection will be closed [ by dispatcher thread ] , and ondisconnect ( ) method will be called to clear all other things . forced means that server shouldn ' t wait with removing this connection .
