コード例 #1
0
ファイル: ClientListener.java プロジェクト: johoe/basex
  /** Exits the session. */
  public synchronized void quit() {
    running = false;
    if (log != null) log.write(this, "LOGOUT " + context.user.name, OK);

    // wait until running command was stopped
    if (command != null) {
      command.stop();
      while (command != null) Performance.sleep(50);
    }
    context.delete(this);

    try {
      new Close().execute(context);
      socket.close();
      if (events) {
        esocket.close();
        // remove this session from all events in pool
        for (final Sessions s : context.events.values()) s.remove(this);
      }
    } catch (final Exception ex) {
      if (log != null) log.write(ex.getMessage());
      Util.stack(ex);
    }
  }