/**
   * Closes the session, the virtual connection and notifies listeners that the connection has been
   * closed.
   */
  @Override
  public void close() {
    if (state.compareAndSet(State.OPEN, State.CLOSED)) {

      if (session != null) {
        session.setStatus(Session.STATUS_CLOSED);
      }

      try {
        closeVirtualConnection();
      } catch (Exception e) {
        Log.error(LocaleUtils.getLocalizedString("admin.error.close") + "\n" + toString(), e);
      }

      notifyCloseListeners();
    }
  }
Exemple #2
0
  public void close() {
    synchronized (this) {
      if (isClosed()) {
        return;
      }
      try {
        deliverRawText(flashClient ? "</flash:stream>" : "</stream:stream>", false);
      } catch (Exception e) {
        // Ignore
      }
      if (session != null) {
        session.setStatus(Session.STATUS_CLOSED);
      }
      closed = true;
    }

    // OF-881: Notify any close listeners after the synchronized block has completed.
    notifyCloseListeners(); // clean up session, etc.

    ioSession.close(false); // async via MINA
  }