org.apache.catalina.Lifecycle.start()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.7k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中org.apache.catalina.Lifecycle.start()方法的一些代码示例,展示了Lifecycle.start()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lifecycle.start()方法的具体详情如下:
包路径:org.apache.catalina.Lifecycle
类名称:Lifecycle
方法名:start

Lifecycle.start介绍

[英]Prepare for the beginning of active use of the public methods other than property getters/setters and life cycle methods of this component. This method should be called before any of the public methods other than property getters/setters and life cycle methods of this component are utilized. The following LifecycleEvents will be fired in the following order:

  1. BEFORE_START_EVENT: At the beginning of the method. It is as this point the state transitions to LifecycleState#STARTING_PREP.
  2. START_EVENT: During the method once it is safe to call start() for any child components. It is at this point that the state transitions to LifecycleState#STARTINGand that the public methods other than property getters/setters and life cycle methods may be used.
  3. AFTER_START_EVENT: At the end of the method, immediately before it returns. It is at this point that the state transitions to LifecycleState#STARTED.
    [中]准备开始积极使用公共方法,而不是此组件的属性getter/setter和生命周期方法。在使用除此组件的属性getter/setter和生命周期方法之外的任何公共方法之前,应该调用此方法。以下生命周期事件将按以下顺序触发:
    1.在启动事件之前:在方法的开头。正是在这一点上,状态转换为LifecycleState#开始#准备。
    1.START_事件:在方法期间,一旦安全,就可以为任何子组件调用START()。正是在这一点上,状态转换为LifecycleState#Starting,并且可以使用除属性getter/setter和生命周期方法之外的公共方法。
    1.在\u开始\u事件之后:在方法结束时,紧接着返回之前。正是在这一点上,状态转换为LifecycleState开始。

代码示例

代码示例来源:origin: org.apache.tomee/tomee-catalina

@Override
public void start() throws LifecycleException {
  if (delegate instanceof Lifecycle) {
    ((Lifecycle) delegate).start();
  }
}

代码示例来源:origin: jboss.web/jbossweb

/**
 * Start a new server instance.
 */
public void start() {
  // Start the new server
  if (server instanceof Lifecycle) {
    try {
      ((Lifecycle) server).start();
    } catch (LifecycleException e) {
      log.error("Catalina.start: ", e);
    }
  }
}

代码示例来源:origin: org.glassfish.main.web/web-core

/**
 * Starts the session manager of this Context.
 */
protected void managerStart() throws LifecycleException {
  if ((manager != null) && (manager instanceof Lifecycle)) {
    ((Lifecycle) getManager()).start();
  }
}

代码示例来源:origin: org.apache.tomee/tomee-catalina

@Override
public void start() throws LifecycleException {
  if (instance() != null && Lifecycle.class.isInstance(delegate)) {
    Lifecycle.class.cast(delegate).start();
  } else {
    start = true;
  }
  state = LifecycleState.STARTED;
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat6

public void doStart() throws Exception {
  server.initialize();
  ((Lifecycle)server).start();
}

代码示例来源:origin: org.apache.tomee/tomee-catalina

@Override
protected void startInternal() throws LifecycleException {
  final Class<?> r = loadClass();
  if (r != null && Lifecycle.class.isAssignableFrom(r) && instance() != null) {
    Lifecycle.class.cast(instance()).start();
  } else {
    start = true;
  }
  setState(LifecycleState.STARTING);
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Start {@link Valve}s) in this pipeline and implement the requirements
 * of {@link LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {
  // Start the Valves in our pipeline (including the basic), if any
  Valve current = first;
  if (current == null) {
    current = basic;
  }
  while (current != null) {
    if (current instanceof Lifecycle)
      ((Lifecycle) current).start();
    current = current.getNext();
  }
  setState(LifecycleState.STARTING);
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Start {@link Valve}s) in this pipeline and implement the requirements
 * of {@link LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {
  // Start the Valves in our pipeline (including the basic), if any
  Valve current = first;
  if (current == null) {
    current = basic;
  }
  while (current != null) {
    if (current instanceof Lifecycle)
      ((Lifecycle) current).start();
    current = current.getNext();
  }
  setState(LifecycleState.STARTING);
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * Start {@link Valve}s) in this pipeline and implement the requirements
 * of {@link LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {
  // Start the Valves in our pipeline (including the basic), if any
  Valve current = first;
  if (current == null) {
    current = basic;
  }
  while (current != null) {
    if (current instanceof Lifecycle)
      ((Lifecycle) current).start();
    current = current.getNext();
  }
  setState(LifecycleState.STARTING);
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {
  super.startInternal();
  if (store == null)
    log.error("No Store configured, persistence disabled");
  else if (store instanceof Lifecycle)
    ((Lifecycle)store).start();
  setState(LifecycleState.STARTING);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {
  super.startInternal();
  if (store == null)
    log.error("No Store configured, persistence disabled");
  else if (store instanceof Lifecycle)
    ((Lifecycle)store).start();
  setState(LifecycleState.STARTING);
}

代码示例来源:origin: org.jboss.jbossas/jboss-as-tomcat

public void startConnectors() throws Exception
{
 if (tomcatDeployer == null)
   throw new IllegalStateException("Must set TomcatDeployer before starting connectors");
 if (connectorsRunning)
   return;
 MBeanServer server = super.getServer();
 ObjectName service = new ObjectName(tomcatDeployer.getDomain() + ":type=Service,serviceName=jboss.web");
 Object[] args = {};
 String[] sig = {};
 Connector[] connectors = (Connector[]) server.invoke(service, "findConnectors", args, sig);
 for (int n = 0; n < connectors.length; n++)
 {
   Lifecycle lc = connectors[n];
   lc.start();
 }
 connectorsRunning = true;
 // Notify listeners that connectors have started processing requests
 sendNotification(new Notification(TOMCAT_CONNECTORS_STARTED, this, getNextNotificationSequenceNumber()));
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {
  super.startInternal();
  if (store == null)
    log.error("No Store configured, persistence disabled");
  else if (store instanceof Lifecycle)
    ((Lifecycle)store).start();
  setState(LifecycleState.STARTING);
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {
  super.startInternal();
  if (store == null)
    log.error("No Store configured, persistence disabled");
  else if (store instanceof Lifecycle)
    ((Lifecycle)store).start();
  setState(LifecycleState.STARTING);
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {
  super.startInternal();
  if (store == null)
    log.error("No Store configured, persistence disabled");
  else if (store instanceof Lifecycle)
    ((Lifecycle)store).start();
  setState(LifecycleState.STARTING);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {
  super.startInternal();
  if (store == null)
    log.error("No Store configured, persistence disabled");
  else if (store instanceof Lifecycle)
    ((Lifecycle)store).start();
  setState(LifecycleState.STARTING);
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {
  super.startInternal();
  if (store == null)
    log.error("No Store configured, persistence disabled");
  else if (store instanceof Lifecycle)
    ((Lifecycle)store).start();
  setState(LifecycleState.STARTING);
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Start this component and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected synchronized void startInternal() throws LifecycleException {
  super.startInternal();
  if (store == null)
    log.error("No Store configured, persistence disabled");
  else if (store instanceof Lifecycle)
    ((Lifecycle)store).start();
  setState(LifecycleState.STARTING);
}

代码示例来源:origin: org.apache.tomee/tomee-catalina

private void addTomEERealm(final Engine engine) {
  final Realm realm = engine.getRealm();
  if (realm != null && !(realm instanceof TomEERealm) && (engine.getParent() == null || (!realm.equals(engine.getParent().getRealm())))) {
    final Realm tomeeRealm = tomeeRealm(realm);
    engine.setRealm(tomeeRealm);
    if (LifecycleState.STARTING_PREP.equals(engine.getState())) {
      try {
        Lifecycle.class.cast(tomeeRealm).start();
      } catch (final LifecycleException e) {
        throw new IllegalStateException(e);
      }
    }
  }
}

代码示例来源:origin: org.mobicents.arquillian.container/mss-tomcat-embedded-6

@Override
public synchronized void addEngine(Engine engine) {
  if( log.isDebugEnabled() )
    log.debug("Adding engine (" + engine.getInfo() + ")");
  // Add this Engine to our set of defined Engines
  Engine results[] = new Engine[engines.length + 1];
  for (int i = 0; i < engines.length; i++)
    results[i] = engines[i];
  results[engines.length] = engine;
  engines = results;
  // Start this Engine if necessary
  if (started && (engine instanceof Lifecycle)) {
    try {
      ((Lifecycle) engine).start();
    } catch (LifecycleException e) {
      log.error("Engine.start", e);
    }
  }
  service.setContainer(engine);
}

相关文章