org.eclipse.jetty.server.Server.isStarting()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(140)

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

Server.isStarting介绍

暂无

代码示例

代码示例来源:origin: jphp-group/jphp

@Signature
public boolean isStarting() {
  return server.isStarting();
}

代码示例来源:origin: 4thline/cling

@Override
synchronized public void startIfNotRunning() {
  if (!server.isStarted() && !server.isStarting()) {
    log.info("Starting Jetty server... ");
    try {
      server.start();
    } catch (Exception ex) {
      log.severe("Couldn't start Jetty server: " + ex);
      throw new RuntimeException(ex);
    }
  }
}

代码示例来源:origin: kingthy/TVRemoteIME

@Override
synchronized public void startIfNotRunning() {
  if (!server.isStarted() && !server.isStarting()) {
    log.info("Starting Jetty server... ");
    try {
      server.start();
    } catch (Exception ex) {
      log.severe("Couldn't start Jetty server: " + ex);
      throw new RuntimeException(ex);
    }
  }
}

代码示例来源:origin: yacy/yacy_grid_mcp

public static boolean isAlive() {
  return server.isRunning() || server.isStarted() || server.isStarting();
}

代码示例来源:origin: org.fourthline.cling/cling-core

@Override
synchronized public void startIfNotRunning() {
  if (!server.isStarted() && !server.isStarting()) {
    log.info("Starting Jetty server... ");
    try {
      server.start();
    } catch (Exception ex) {
      log.severe("Couldn't start Jetty server: " + ex);
      throw new RuntimeException(ex);
    }
  }
}

代码示例来源:origin: logzio/apollo

@PreDestroy
public void stop() {
  logger.info("Stopping Jetty server");
  if (server.isStarted() || server.isStarting()) {
    try {
      server.stop();
    } catch (Exception e) {
      logger.warn("Could not stop Jetty server!", e);
    }
  } else {
    logger.warn("Jetty already stopped, or did not start. can't stop!");
  }
}

代码示例来源:origin: org.simplericity.jettyconsole/jetty-console-core

public void shutdown() {
  log.info("Shutting down " + name + "..");
  try {
    if (server != null && (server.isStarted() || server.isStarting())) {
      server.stop();
      log.info("Shutdown of " + name + " complete.");
      for (JettyListener listener : listenerList) {
        listener.serverStopped();
      }
    }
  } catch (Exception e) {
    log.info("Exception shutting down " + name + ": " + e.getMessage(), e);
  }
}

代码示例来源:origin: kumuluz/kumuluzee

@Override
public void startServer() {
  if (server == null)
    throw new IllegalStateException("Jetty has to be initialized before starting it");
  if (server.isStarted() || server.isStarting())
    throw new IllegalStateException("Jetty is already started");
  try {
    server.start();
  } catch (Exception e) {
    log.severe(e.getMessage());
    throw new KumuluzServerException(e.getMessage(), e);
  }
}

代码示例来源:origin: kumuluz/kumuluzee

@Override
public void registerListener(EventListener listener) {
  if (server == null)
    throw new IllegalStateException("Jetty has to be initialized before adding a listener");
  if (server.isStarted() || server.isStarting())
    throw new IllegalStateException("Jetty cannot be started before adding a listener");
  appContext.addEventListener(listener);
}

代码示例来源:origin: kumuluz/kumuluzee

@Override
public void registerServlet(Class<? extends Servlet> servletClass, String mapping, Map<String, String>
    parameters, int initOrder) {
  if (server == null)
    throw new IllegalStateException("Jetty has to be initialized before adding a servlet ");
  if (server.isStarted() || server.isStarting())
    throw new IllegalStateException("Jetty cannot be started before adding a servlet");
  @SuppressWarnings("unchecked")
  Class<Servlet> servlet = (Class<Servlet>) servletClass;
  ServletHolder holder = new ServletHolder(servlet);
  holder.setInitOrder(initOrder);
  if (parameters != null) {
    parameters.forEach(holder::setInitParameter);
  }
  appContext.addServlet(holder, mapping);
}

代码示例来源:origin: kumuluz/kumuluzee

@Override
public void registerFilter(Class<? extends Filter> filterClass, String pathSpec, EnumSet<DispatcherType> dispatches, Map<String,
    String> parameters) {
  if (server == null)
    throw new IllegalStateException("Jetty has to be initialized before adding a servlet ");
  if (server.isStarted() || server.isStarting())
    throw new IllegalStateException("Jetty cannot be started before adding a servlet");
  FilterHolder holder = new FilterHolder(filterClass);
  if (parameters != null) {
    parameters.forEach(holder::setInitParameter);
  }
  appContext.addFilter(holder, pathSpec, dispatches);
}

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

protected boolean isRunning(org.eclipse.jetty.server.Server server) {
  return server.isStarting() || server.isStarted() || server.isRunning();
}

代码示例来源:origin: org.testatoo.container/testatoo-container-jetty

protected boolean isRunning(Server server) {
  return server.isStarting() || server.isStarted() || server.isRunning();
}

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

protected boolean isRunning(org.eclipse.jetty.server.Server server) {
  return server.isStarting() || server.isStarted() || server.isRunning();
}

代码示例来源:origin: org.simplericity.jettyconsole/jetty-console-core

public void stopServer() {
  if(webapp != null) {
    for (JettyConsolePlugin plugin : pluginManager.getPlugins()) {
      plugin.beforeStop(webapp);
    }
  }
  try {
    if (server != null && (server.isStarted() || server.isStarting())) {
      server.stop();
    }
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

/**
 * @param contextPath
 *            The _contextPath to set.
 */
public void setContextPath(String contextPath)
{
  if (contextPath != null && contextPath.length() > 1 && contextPath.endsWith("/"))
    throw new IllegalArgumentException("ends with /");
  _contextPath = contextPath;
  if (getServer() != null && (getServer().isStarting() || getServer().isStarted()))
  {
    Handler[] contextCollections = getServer().getChildHandlersByClass(ContextHandlerCollection.class);
    for (int h = 0; contextCollections != null && h < contextCollections.length; h++)
      ((ContextHandlerCollection)contextCollections[h]).mapContexts();
  }
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

/**
 * @param contextPath
 *            The _contextPath to set.
 */
public void setContextPath(String contextPath)
{
  if (contextPath != null && contextPath.length() > 1 && contextPath.endsWith("/"))
    throw new IllegalArgumentException("ends with /");
  _contextPath = contextPath;
  if (getServer() != null && (getServer().isStarting() || getServer().isStarted()))
  {
    Handler[] contextCollections = getServer().getChildHandlersByClass(ContextHandlerCollection.class);
    for (int h = 0; contextCollections != null && h < contextCollections.length; h++)
      ((ContextHandlerCollection)contextCollections[h]).mapContexts();
  }
}

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

/**
 * @param contextPath
 *            The _contextPath to set.
 */
public void setContextPath(String contextPath)
{
  if (contextPath != null && contextPath.length() > 1 && contextPath.endsWith("/"))
    throw new IllegalArgumentException("ends with /");
  _contextPath = contextPath;
  if (getServer() != null && (getServer().isStarting() || getServer().isStarted()))
  {
    Handler[] contextCollections = getServer().getChildHandlersByClass(ContextHandlerCollection.class);
    for (int h = 0; contextCollections != null && h < contextCollections.length; h++)
      ((ContextHandlerCollection)contextCollections[h]).mapContexts();
  }
}

代码示例来源:origin: apache/incubator-edgent

/**
 * Checks to see if the jetty web server is started
 * @return a boolean: true if the server is started, false if not
 */
public boolean isServerStarted() {
  if (getJettyServer().isStarted() || getJettyServer().isStarting() || getJettyServer().isRunning()) {
    return true;
  }
  else {
    return false;
  }
}

代码示例来源:origin: org.apache.edgent/edgent-console-server

/**
 * Checks to see if the jetty web server is started
 * @return a boolean: true if the server is started, false if not
 */
public boolean isServerStarted() {
  if (getJettyServer().isStarted() || getJettyServer().isStarting() || getJettyServer().isRunning()) {
    return true;
  }
  else {
    return false;
  }
}

相关文章