public void start() {
    _mngmtLock.writeLock().lock();
    try {
      if (!checkState(State.INIT, State.RUNNING)) {
        __log.debug("start() ignored -- already started");
        return;
      }
      __log.debug("BPEL SERVER starting.");

      // Eventually running some migrations before starting
      if (!(new MigrationHandler(_contexts)
          .migrate(_registeredProcesses, _migrationTransactionTimeout))) {
        throw new BpelEngineException(
            "An error occurred while migrating your database to a newer version of the server. Please make sure that the required migration scripts have been executed before starting the server.");
      }

      _state = State.RUNNING;
      __log.info(__msgs.msgServerStarted());
      if (_dehydrationPolicy != null) {
        processDefReaper = new Thread(new ProcessDefReaper(), "Dehydrator");
        processDefReaper.setDaemon(true);
        processDefReaper.start();
      }
    } finally {
      _mngmtLock.writeLock().unlock();
    }
  }
Beispiel #2
0
  public void start() {
    if (!checkState(State.INIT, State.RUNNING)) {
      __log.debug("start() ignored -- already started");
      return;
    }

    __log.debug("BPEL SERVER starting.");

    if (_exec == null) {
      ThreadFactory threadFactory =
          new ThreadFactory() {
            int threadNumber = 0;

            public Thread newThread(Runnable r) {
              threadNumber += 1;
              Thread t = new Thread(r, "ODEServerImpl-" + threadNumber);
              t.setDaemon(true);
              return t;
            }
          };
      _exec = Executors.newCachedThreadPool(threadFactory);
    }

    if (_contexts.txManager == null) {
      String errmsg = "Transaction manager not specified; call setTransactionManager(...)!";
      __log.fatal(errmsg);
      throw new IllegalStateException(errmsg);
    }

    if (_contexts.scheduler == null) {
      String errmsg = "Scheduler not specified; call setScheduler(...)!";
      __log.fatal(errmsg);
      throw new IllegalStateException(errmsg);
    }

    _contexts.scheduler.start();
    _state = State.RUNNING;
    __log.info(__msgs.msgServerStarted());
    if (_dehydrationPolicy != null) new Thread(new ProcessDefReaper()).start();
  }