public final void close(GsServerPacket closePacket,boolean forced){
synchronized (guard) {
    if (isWriteDisabled()) {
      return;
    }
    pendingClose=true;
    isForcedClosing=forced;
    sendMsgQueue.clear();
    sendMsgQueue.addLast(closePacket);
    enableWriteInterest();
  }
}

public final void close ( GsServerPacket closePacket , boolean forced ) { synchronized ( guard ) { if ( isWriteDisabled ( ) ) { return ; } 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 .
