org.apache.catalina.LifecycleException类的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(11.0k)|赞(0)|评价(0)|浏览(87)

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

LifecycleException介绍

[英]General purpose exception that is thrown to indicate a lifecycle related problem. Such exceptions should generally be considered fatal to the operation of the application containing this component.
[中]为指示与生命周期相关的问题而引发的通用异常。此类异常通常应被视为对包含此组件的应用程序的操作是致命的。

代码示例

代码示例来源:origin: apache/geode

public void startInternal() throws LifecycleException {
 super.startInternal();
 if (getLogger().isDebugEnabled()) {
  getLogger().debug(this + ": Starting");
 this.lifecycle.fireLifecycleEvent(START_EVENT, null);
  load();
 } catch (ClassNotFoundException e) {
  throw new LifecycleException("Exception starting manager", e);
 } catch (IOException e) {
  throw new LifecycleException("Exception starting manager", e);

代码示例来源:origin: apache/geode

/**
 * Stops the embedded Tomcat server.
 */
public void stopContainer() {
 try {
  if (container != null) {
   container.stop();
   logger.info("Stopped container");
  }
 } catch (LifecycleException exception) {
  logger.warn("Cannot Stop Tomcat" + exception.getMessage());
 }
}

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

/**
 * Prepare for the beginning of active use of the public methods of this
 * component.  This method should be called after <code>configure()</code>,
 * and before any of the public methods of the component are utilized.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
public void start() throws LifecycleException {
  // Validate and update our current component state
  if (started)
    throw new LifecycleException
      (rb.getString(LogFacade.STORE_BASE_STARTED_EXCEPTION));
  lifecycle.fireLifecycleEvent(START_EVENT, null);
  started = true;
}

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

/**
 * Gracefully terminate the active use of the public methods of this
 * component.  This method should be the last one called on a given
 * instance of this component.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that needs to be reported
 */
@Override
public void stop() throws LifecycleException {
  if (log.isLoggable(Level.FINE))
    log.log(Level.FINE, "Stopping embedded server");
  // Validate and update our current component state
  if (!started)
    throw new LifecycleException
      (rb.getString(LogFacade.SERVICE_NOT_BEEN_STARTED_EXCEPTION));
  lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  started = false;
  // Stop our defined Connectors first
  for (int i = 0; i < connectors.length; i++) {
    if (connectors[i] instanceof Lifecycle)
      ((Lifecycle) connectors[i]).stop();
  }
  // Stop our defined Engines second
  for (int i = 0; i < engines.length; i++) {
    if (engines[i] instanceof Lifecycle)
      ((Lifecycle) engines[i]).stop();
  }
}

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

throw new LifecycleException
      (rb.getString(LogFacade.PIPLINE_STARTED));
lifecycle.fireLifecycleEvent(BEFORE_START_EVENT, null);
    ((Lifecycle) valves[i]).start();
  ((Lifecycle) basic).start();
lifecycle.fireLifecycleEvent(START_EVENT, null);
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);

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

/**
 * Gracefully terminate the active use of the public methods of this
 * component.  This method should be the last one called on a given
 * instance of this component.
 *
 * @throws IllegalStateException if this component has not been started
 * @throws LifecycleException    if this component detects a fatal error
 *                               that needs to be reported
 */
public void stop() throws LifecycleException {
  // Validate and update our current component state
  if (!_started) {
    String msg = rb.getString("webcontainer.notStarted");
    throw new LifecycleException(msg);
  }
  _started = false;
  // stop the embedded container
  try {
    _embedded.stop();
  } catch (LifecycleException ex) {
    if (!ex.getMessage().contains("has not been started")) {
      throw ex;
    }
  }
}

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

/**
 * Process the START event for an associated Context.
 *
 * @param event The lifecycle event that has occurred
 */
public void lifecycleEvent(LifecycleEvent event)
    throws LifecycleException {
  // Identify the context we are associated with
  try {
    context = (Context) event.getLifecycle();
  } catch (ClassCastException e) {
    String msg = MessageFormat.format(rb.getString(LogFacade.EVENT_DATA_IS_NOT_CONTEXT_EXCEPTION),
                     event.getLifecycle());
    throw new LifecycleException(msg, e);
  }
  // Called from ContainerBase.addChild() -> StandardContext.start()
  // Process the event that has occurred
  if (event.getType().equals(Lifecycle.START_EVENT)) {
    start();
  } else if (event.getType().equals(Lifecycle.STOP_EVENT)) {
    stop();
  // START GlassFish 2439
  } else if (event.getType().equals(Lifecycle.INIT_EVENT)) {
    init();
  // END GlassFish 2439
  }
}

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

private void handleSubClassException(Throwable t, String key, Object... args) throws LifecycleException {
    ExceptionUtils.handleThrowable(t);
    setStateInternal(LifecycleState.FAILED, null, false);
    String msg = sm.getString(key, args);
    if (getThrowOnFailure()) {
      if (!(t instanceof LifecycleException)) {
        t = new LifecycleException(msg, t);
      }
      throw (LifecycleException) t;
    } else {
      log.error(msg, t);
    }
  }
}

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

protected void startInternal() throws LifecycleException {
  if (log.isDebugEnabled())
    log.debug(sm.getString("webappLoader.starting"));
    log.info("No resources for " + context);
    setState(LifecycleState.STARTING);
    return;
    ((Lifecycle) classLoader).start();
    ExceptionUtils.handleThrowable(t);
    log.error( "LifecycleException ", t );
    throw new LifecycleException("start: ", t);

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

private void invalidTransition(String type) throws LifecycleException {
    String msg = sm.getString("lifecycleBase.invalidTransition", type,
        toString(), state);
    throw new LifecycleException(msg);
  }
}

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

LifecycleState.DESTROYED.equals(state)) {
if (log.isDebugEnabled()) {
  Exception e = new LifecycleException();
  log.debug(sm.getString("lifecycleBase.alreadyDestroyed",
      toString()), e);
} else if (log.isInfoEnabled()) {
  log.info(sm.getString("lifecycleBase.alreadyDestroyed",
      toString()));

代码示例来源:origin: redisson/redisson

@Override
public void stop() throws LifecycleException {
  try {
    shutdownRedisson();
  } catch (Exception e) {
    throw new LifecycleException(e);
  }
  
  lifecycle.fireLifecycleEvent(STOP_EVENT, null);
}

代码示例来源:origin: apache/geode

public void startInternal() throws LifecycleException {
 super.startInternal();
 if (getLogger().isDebugEnabled()) {
  getLogger().debug(this + ": Starting");
  load();
 } catch (ClassNotFoundException e) {
  throw new LifecycleException("Exception starting manager", e);
 } catch (IOException e) {
  throw new LifecycleException("Exception starting manager", e);

代码示例来源:origin: redisson/redisson

protected RedissonClient buildClient() throws LifecycleException {
  Config config = null;
  try {
    config = Config.fromJSON(new File(configPath), getClass().getClassLoader());
  } catch (IOException e) {
    // trying next format
    try {
      config = Config.fromYAML(new File(configPath), getClass().getClassLoader());
    } catch (IOException e1) {
      log.error("Can't parse json config " + configPath, e);
      throw new LifecycleException("Can't parse yaml config " + configPath, e1);
    }
  }
  
  try {
    return Redisson.create(config);
  } catch (Exception e) {
    throw new LifecycleException(e);
  }
}

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

/**
 * Start Cluster 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 void startInternal() throws LifecycleException {
  if (log.isInfoEnabled()) log.info(sm.getString("simpleTcpCluster.start"));
  try {
    checkDefaults();
    registerClusterValve();
    channel.addMembershipListener(this);
    channel.addChannelListener(this);
    channel.setName(getClusterName() + "-Channel");
    channel.start(channelStartOptions);
    if (clusterDeployer != null) clusterDeployer.start();
    registerMember(channel.getLocalMember(false));
  } catch (Exception x) {
    log.error(sm.getString("simpleTcpCluster.startUnable"), x);
    throw new LifecycleException(x);
  }
  setState(LifecycleState.STARTING);
}

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

try (InputStream is = ConfigFileLoader.getSource().getResource(pathName).getInputStream()) {
  if (log.isDebugEnabled()) {
    log.debug(sm.getString("memoryRealm.loadPath", pathName));
    throw new LifecycleException(sm.getString("memoryRealm.readXml"), e);
  } finally {
    digester.reset();
  throw new LifecycleException(sm.getString("memoryRealm.loadExist", pathName), ioe);

代码示例来源:origin: chexagon/redis-session-manager

@Override
protected synchronized void startInternal() throws LifecycleException {
  super.startInternal();
  try {
    this._client = buildClient();
  } catch (Throwable t) {
    log.fatal("Unable to load serializer", t);
    throw new LifecycleException(t);
  }
  this.requestValve = new RedisSessionRequestValve(this, ignorePattern);
  getContext().getParent().getPipeline().addValve(requestValve);
  this.sessionExpirationTime = getContext().getSessionTimeout();
  if (this.sessionExpirationTime < 0) {
    log.warn("Ignoring negative session expiration time");
    this.sessionExpirationTime = 0;
  }
  log.info("Will expire sessions after " + sessionExpirationTime + " minutes");
  setState(LifecycleState.STARTING);
}

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

@Override
public void start() throws LifecycleException {
  if( log.isInfoEnabled() )
    log.info("Starting tomcat server");
  // Validate the setup of our required system properties
  initDirs();
  // Initialize some naming specific properties
  initNaming();
  // Validate and update our current component state
  if (started)
    throw new LifecycleException
      (sm.getString("embedded.alreadyStarted"));
  lifecycle.fireLifecycleEvent(START_EVENT, null);
  started = true;
  service.initialize();
  // Start our defined Engines first
  for (int i = 0; i < engines.length; i++) {
    if (engines[i] instanceof Lifecycle)
      ((Lifecycle) engines[i]).start();
  }
  // Start our defined Connectors second
  Connector[] connectors = service.findConnectors();
  for (int i = 0; i < connectors.length; i++) {
    connectors[i].initialize();
    if (connectors[i] instanceof Lifecycle)
      ((Lifecycle) connectors[i]).start();
  }
}

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

lifecycle.fireLifecycleEvent(INIT_EVENT, null);
  throw new LifecycleException
    (sm.getString("embedded.alreadyStarted"));
lifecycle.fireLifecycleEvent(START_EVENT, null);
started = true;
    ((Lifecycle) engines[i]).start();
  connectors[i].initialize();
  if (connectors[i] instanceof Lifecycle)
    ((Lifecycle) connectors[i]).start();

代码示例来源:origin: tomcat/catalina

/**
 * Gracefully terminate the active use of the public methods of this
 * component.  This method should be the last one called on a given
 * instance of this component.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that needs to be reported
 */
public void stop() throws LifecycleException {
  if( log.isDebugEnabled() )
    log.debug("Stopping embedded server");
  // Validate and update our current component state
  if (!started)
    throw new LifecycleException
      (sm.getString("embedded.notStarted"));
  lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  started = false;
  // Stop our defined Connectors first
  for (int i = 0; i < connectors.length; i++) {
    if (connectors[i] instanceof Lifecycle)
      ((Lifecycle) connectors[i]).stop();
  }
  // Stop our defined Engines second
  for (int i = 0; i < engines.length; i++) {
    if (engines[i] instanceof Lifecycle)
      ((Lifecycle) engines[i]).stop();
  }
}

相关文章

微信公众号

最新文章

更多