Esempio n. 1
0
  public synchronized void start() throws Exception {
    synchronized (stoppingGuard) {
      stopping = false;
    }

    if (started) {
      HornetQJMSServerLogger.LOGGER.errorBridgeAlreadyStarted();
      return;
    }

    if (JMSBridgeImpl.trace) {
      HornetQJMSServerLogger.LOGGER.trace("Starting " + this);
    }

    // bridge has been stopped and is restarted
    if (executor.isShutdown()) {
      executor = createExecutor();
    }

    initPasswords();

    checkParams();

    TransactionManager tm = getTm();

    // There may already be a JTA transaction associated to the thread

    boolean ok;

    Transaction toResume = null;
    try {
      toResume = tm.suspend();

      ok = setupJMSObjects();
    } finally {
      if (toResume != null) {
        tm.resume(toResume);
      }
    }

    if (ok) {
      startSource();
    } else {
      HornetQJMSServerLogger.LOGGER.errorStartingBridge();
      handleFailureOnStartup();
    }
  }