コード例 #1
0
ファイル: ServerSessionImpl.java プロジェクト: mto/hornetq
  private synchronized void doClose(final boolean failed) throws Exception {
    if (tx != null && tx.getXid() == null) {
      // We only rollback local txs on close, not XA tx branches

      try {
        rollback(failed, false);
      } catch (Exception e) {
        HornetQLogger.LOGGER.warn(e.getMessage(), e);
      }
    }

    Set<ServerConsumer> consumersClone = new HashSet<ServerConsumer>(consumers.values());

    for (ServerConsumer consumer : consumersClone) {
      consumer.close(failed);
    }

    consumers.clear();

    server.removeSession(name);

    if (currentLargeMessage != null) {
      try {
        currentLargeMessage.deleteFile();
      } catch (Throwable error) {
        HornetQLogger.LOGGER.errorDeletingLargeMessageFile(error);
      }
    }

    remotingConnection.removeFailureListener(this);

    callback.closed();
  }
コード例 #2
0
  private void doClose(final boolean failed) throws Exception {
    synchronized (this) {
      if (closed) return;

      if (tx != null && tx.getXid() == null) {
        // We only rollback local txs on close, not XA tx branches

        try {
          rollback(failed, false);
        } catch (Exception e) {
          HornetQServerLogger.LOGGER.warn(e.getMessage(), e);
        }
      }

      server.removeSession(name);

      remotingConnection.removeFailureListener(this);

      callback.closed();

      closed = true;
    }

    // putting closing of consumers outside the sync block
    // https://issues.jboss.org/browse/HORNETQ-1141
    Set<ServerConsumer> consumersClone = new HashSet<ServerConsumer>(consumers.values());

    for (ServerConsumer consumer : consumersClone) {
      consumer.close(failed);
    }

    consumers.clear();

    if (currentLargeMessage != null) {
      try {
        currentLargeMessage.deleteFile();
      } catch (Throwable error) {
        HornetQServerLogger.LOGGER.errorDeletingLargeMessageFile(error);
      }
    }
  }