예제 #1
0
  @Override
  protected void doSend(final ServerMessage msg, final boolean direct) throws Exception {
    if (!this.internal) {
      super.doSend(msg, direct);
      return;
    }

    // bypass security check for internal sessions
    if (tx == null || autoCommitSends) {
    } else {
      routingContext.setTransaction(tx);
    }

    try {
      postOffice.route(msg, routingContext, direct);

      Pair<UUID, AtomicLong> value = targetAddressInfos.get(msg.getAddress());

      if (value == null) {
        targetAddressInfos.put(
            msg.getAddress(), new Pair<UUID, AtomicLong>(msg.getUserID(), new AtomicLong(1)));
      } else {
        value.setA(msg.getUserID());
        value.getB().incrementAndGet();
      }
    } finally {
      routingContext.clear();
    }
  }
예제 #2
0
 protected void doClose(final boolean failed) throws Exception {
   synchronized (this) {
     if (tx != null && tx.getXid() == null) {
       ((AMQTransactionImpl) tx).setRollbackForClose();
     }
   }
   super.doClose(failed);
 }
예제 #3
0
  @Override
  public void createQueue(
      final SimpleString address,
      final SimpleString name,
      final SimpleString filterString,
      final boolean temporary,
      final boolean durable)
      throws Exception {
    if (!this.internal) {
      super.createQueue(address, name, filterString, temporary, durable);
      return;
    }

    server.createQueue(address, name, filterString, durable, temporary);

    if (temporary) {
      // Temporary queue in core simply means the queue will be deleted if
      // the remoting connection
      // dies. It does not mean it will get deleted automatically when the
      // session is closed.
      // It is up to the user to delete the queue when finished with it

      TempQueueCleanerUpper cleaner = new TempQueueCleanerUpper(server, name);

      remotingConnection.addCloseListener(cleaner);
      remotingConnection.addFailureListener(cleaner);

      tempQueueCleannerUppers.put(name, cleaner);
    }

    if (ActiveMQServerLogger.LOGGER.isDebugEnabled()) {
      ActiveMQServerLogger.LOGGER.debug(
          "Queue "
              + name
              + " created on address "
              + name
              + " with filter="
              + filterString
              + " temporary = "
              + temporary
              + " durable="
              + durable
              + " on session user="******", connection="
              + this.remotingConnection);
    }
  }