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

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

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

Server.destroy介绍

暂无

代码示例

代码示例来源:origin: alibaba/jvm-sandbox

private void closeHttpServer() {
  if (null != httpServer) {
    httpServer.destroy();
  }
}

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

public void shutdownServer() throws Exception {
  jetty.stop();
  jetty.destroy();
}

代码示例来源:origin: Dreampie/Resty

public void destroy() throws Exception {
 webAppContext.destroy();
 server.destroy();
}

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

private void shutdownHttpServer(Server toShutdown) {
  try {
    toShutdown.stop();
    toShutdown.destroy();
  } catch (final Exception ex) {
    getLogger().warn("unable to cleanly shutdown embedded server due to {}", new Object[] {ex});
    this.server = null;
  }
}

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

public void stop() {
  if (this.httpServer == null) {
   return;
  }

  logger.debug("Stopping the HTTP service...");
  try {
   for (WebAppContext webapp : webApps) {
    webapp.stop();
   }
   this.httpServer.stop();
  } catch (Exception e) {
   logger.warn("Failed to stop the HTTP service because: {}", e.getMessage(), e);
  } finally {
   try {
    this.httpServer.destroy();
   } catch (Exception ignore) {
    logger.info("Failed to properly release resources held by the HTTP service: {}",
      ignore.getMessage(), ignore);
   } finally {
    this.httpServer = null;
    System.clearProperty("catalina.base");
    System.clearProperty("catalina.home");
   }
  }
 }
}

代码示例来源:origin: spring-projects/spring-framework

@Override
protected void resetInternal() {
  try {
    if (this.jettyServer.isRunning()) {
      this.jettyServer.setStopTimeout(5000);
      this.jettyServer.stop();
      this.jettyServer.destroy();
    }
  }
  catch (Exception ex) {
    throw new IllegalStateException(ex);
  }
  finally {
    this.jettyServer = null;
    this.contextHandler = null;
  }
}

代码示例来源:origin: ninjaframework/ninja

@Override
public void doShutdown() {
  try {
    if (this.contextHandler != null) {
      this.contextHandler.stop();
      this.contextHandler.destroy();
    }
  } catch (Exception e) {
    // keep 
  }
      try {
    if (this.jetty != null) {
      logger.info("Trying to stop jetty {}", getLoggableIdentifier());
      this.jetty.stop();
      this.jetty.destroy();
      logger.info("Stopped jetty {}", getLoggableIdentifier());
    }
  } catch (Exception e) {
    log.error("Unable to cleanly stop jetty", e);
    //throw new RuntimeException(e);
  }
}

代码示例来源:origin: alibaba/jvm-sandbox

@Override
public void unbind() throws IOException {
  try {
    initializer.destroyProcess(new Initializer.Processor() {
      @Override
      public void process() throws Throwable {
        if (null != httpServer) {
          // stop http server
          logger.info("{} is stopping", JettyCoreServer.this);
          httpServer.stop();
        }
      }
    });
    // destroy http server
    logger.info("{} is destroying", this);
    httpServer.destroy();
    // 关闭对象池
    logger.info("{} is closing event-pool", this);
    EventListenerHandlers.getSingleton().getEventPool().close();
  } catch (Throwable cause) {
    logger.warn("{} unBind failed.", this, cause);
    throw new IOException("unBind failed.", cause);
  }
}

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

@OnStopped
public void shutdown() throws Exception {
  if (server != null) {
    getLogger().debug("Shutting down server");
    server.stop();
    server.destroy();
    server.join();
    getLogger().info("Shut down {}", new Object[]{server});
  }
}

代码示例来源:origin: line/armeria

@AfterClass
  public static void stopJetty() throws Exception {
    if (jetty != null) {
      jetty.stop();
      jetty.destroy();
    }
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Override
protected void stopInternal() throws Exception {
  try {
    if (this.contextHandler.isRunning()) {
      this.contextHandler.stop();
    }
  }
  finally {
    try {
      if (this.jettyServer.isRunning()) {
        this.jettyServer.setStopTimeout(5000);
        this.jettyServer.stop();
        this.jettyServer.destroy();
      }
    }
    catch (Exception ex) {
      // ignore
    }
  }
}

代码示例来源:origin: line/armeria

try {
  logger.info("Destroying an embedded Jetty: {}", server);
  server.destroy();
} catch (Exception e) {
  logger.warn("Failed to destroy an embedded Jetty: {}", server, e);

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

@Override
public void destroy() {
  server.destroy();
}

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

public static void stop() {
  try {
    server.stop();
    server.destroy();
  } catch (Exception e) {
    Data.logger.warn("", e);
  }
}

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

public void tearDown() throws Exception {
    super.tearDown();

    if (server != null) {
      server.stop();
      server.destroy();
      server = null;
    }
  }
}

代码示例来源:origin: Nike-Inc/wingtips

public static void main(String[] args) throws Exception {
  Server server = createServer(Integer.parseInt(System.getProperty(PORT_SYSTEM_PROP_KEY, "8080")));
  try {
    server.start();
    server.join();
  }
  finally {
    server.destroy();
  }
}

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

public void tearDown() throws Exception {
  super.tearDown();
  if (server != null) {
    server.stop();
    server.destroy();
    server = null;
  }
}

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

public void tearDown() throws Exception {
  super.tearDown();
  if (server != null) {
    server.stop();
    server.destroy();
    server = null;
  }
}

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

public void tearDown() throws Exception {
  if (faultToserver != null) {
    faultToserver.stop();
    faultToserver.destroy();
    faultToserver = null;
  }
  ep.stop();
  ep = null;
}

代码示例来源:origin: Nike-Inc/wingtips

@AfterClass
public static void afterClass() throws Exception {
  if (server != null) {
    server.stop();
    server.destroy();
  }
}

相关文章