org.eclipse.jetty.util.component.LifeCycle.stop()方法的使用及代码示例

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

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

LifeCycle.stop介绍

[英]Stops the component. The component may wait for current activities to complete normally, but it can be interrupted.
[中]停止组件。组件可以等待当前活动正常完成,但可以中断。

代码示例

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

@Override
public void destroy() throws Exception {
  try {
    if (this.executor instanceof LifeCycle) {
      ((LifeCycle)this.executor).stop();
    }
  }
  catch (Throwable ex) {
    // ignore
  }
  try {
    if (this.scheduler != null) {
      this.scheduler.stop();
    }
  }
  catch (Throwable ex) {
    // ignore
  }
}

代码示例来源:origin: org.springframework/spring-web

@Override
public void destroy() throws Exception {
  try {
    if (this.executor instanceof LifeCycle) {
      ((LifeCycle)this.executor).stop();
    }
  }
  catch (Throwable ex) {
    // ignore
  }
  try {
    if (this.scheduler != null) {
      this.scheduler.stop();
    }
  }
  catch (Throwable ex) {
    // ignore
  }
}

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

/**
 * Stops the given lifecycle.
 *
 * @param l the lifecycle to stop
 * @throws Exception if unable to stop the lifecycle
 */
protected void stop(LifeCycle l) throws Exception
{
  l.stop();
}

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

/**
   * Utility to stop an object if it is a LifeCycle and to convert
   * any exception thrown to a {@link RuntimeException}
   * @param object The instance to stop.
   * @throws RuntimeException if the call to stop throws an exception.
   */
  public static void stop(Object object)
  {
    if (object instanceof LifeCycle)
    {
      try
      {
        ((LifeCycle)object).stop();
      }
      catch(Exception e)
      {
        throw new RuntimeException(e);
      }
    }
  }
}

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

@Override
public void lifeCycleStarted(LifeCycle lifecycle)
{          
  try
  {
    _lifecycle.stop();
  }
  catch(Exception e)
  {
    LOG.warn(e);
  }  
}

代码示例来源:origin: HubSpot/Singularity

public void stop() throws Exception {
 ImmutableSet<LifeCycle> managedObjects = ImmutableSet.copyOf(environment.lifecycle().getManagedObjects());
 for (LifeCycle managed : Lists.reverse(managedObjects.asList())) {
  managed.stop();
 }
}

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

@Override
  public void run()
  {
    for (LifeCycle lifeCycle : _thread._lifeCycles)
    {
      try
      {
        if (lifeCycle.isStarted())
        {
          lifeCycle.stop();
          LOG.debug("Stopped {}",lifeCycle);
        }

        if (lifeCycle instanceof Destroyable)
        {
          ((Destroyable)lifeCycle).destroy();
          LOG.debug("Destroyed {}",lifeCycle);
        }
      }
      catch (Exception ex)
      {
        LOG.debug(ex);
      }
    }
  }
}

代码示例来源:origin: i2p/i2p.i2p

public void run() {
    for (LifeCycle lc : _jettys) {
      if (lc.isRunning()) {
        try {
          lc.stop();
        } catch (Exception e) {
          changeState(STOPPING, e);
        }
      }
    }
    if (_context != null) {
      PortMapper pm = _context.portMapper();
      if (_port > 0 && pm.getPort(PortMapper.SVC_EEPSITE) == _port) {
        _port = 0;
        pm.unregister(PortMapper.SVC_EEPSITE);
      }
      if (_sslPort > 0 && pm.getPort(PortMapper.SVC_HTTPS_EEPSITE) == _sslPort) {
        _sslPort = 0;
        pm.unregister(PortMapper.SVC_HTTPS_EEPSITE);
      }
    }
    changeState(STOPPED);
  }
}

代码示例来源:origin: Nextdoor/bender

/**
 * Stops the given lifecycle.
 *
 * @param l
 * @throws Exception
 */
protected void stop(LifeCycle l) throws Exception
{
  l.stop();
}

代码示例来源:origin: jenkinsci/winstone

/**
 * Stops the given lifecycle.
 *
 * @param l the lifecycle to stop
 * @throws Exception if unable to stop the lifecycle
 */
protected void stop(LifeCycle l) throws Exception
{
  l.stop();
}

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

/**
 * @see org.eclipse.jetty.server.handler.HandlerWrapper#doStop()
 */
@Override
protected void doStop() throws Exception
{
  super.doStop();
  
  if (!_loginServiceShared && _loginService instanceof LifeCycle)
    ((LifeCycle)_loginService).stop();
  
}

代码示例来源:origin: jenkinsci/winstone

@Override
public void lifeCycleStarted(LifeCycle lifecycle)
{          
  try
  {
    _lifecycle.stop();
  }
  catch(Exception e)
  {
    LOG.warn(e);
  }  
}

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

/**
 * @see org.eclipse.jetty.server.handler.HandlerWrapper#doStop()
 */
@Override
protected void doStop() throws Exception
{
  super.doStop();
  
  if (!_loginServiceShared && _loginService instanceof LifeCycle)
    ((LifeCycle)_loginService).stop();
  
}

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

/**
 * @see org.eclipse.jetty.server.handler.HandlerWrapper#doStop()
 */
@Override
protected void doStop() throws Exception
{
  super.doStop();
  
  if (!_loginServiceShared && _loginService instanceof LifeCycle)
    ((LifeCycle)_loginService).stop();
  
}

代码示例来源:origin: sonatype/nexus-public

public void stopComponents() throws Exception {
 Collections.reverse(components);
 // if Jetty thread is still waiting for a component to start, this should unblock it
 interrupt();
 for (LifeCycle component : components) {
  if (component.isRunning()) {
   log.info("Stopping: {}", component);
   component.stop();
  }
 }
 components.clear();
 stopped.await();
}

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

@Override
protected void doStop() throws Exception
{
  _selectorManager.stop();
  ThreadPool threadPool = _threadPool;
  if (_privateThreadPool && _threadPool != null && threadPool instanceof LifeCycle)
    ((LifeCycle)threadPool).stop();
  super.doStop();
}

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

@Override
protected void doStop() throws Exception
{
  _selectorManager.stop();
  ThreadPool threadPool = _threadPool;
  if (_privateThreadPool && _threadPool != null && threadPool instanceof LifeCycle)
    ((LifeCycle)threadPool).stop();
  super.doStop();
}

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

@Override
protected void doStop() throws Exception
{
  _selectorManager.stop();
  ThreadPool threadPool = _threadPool;
  if (_privateThreadPool && _threadPool != null && threadPool instanceof LifeCycle)
    ((LifeCycle)threadPool).stop();
  super.doStop();
}

代码示例来源:origin: jenkinsci/winstone

@Override
public void onClose()
{
  if (LOG.isDebugEnabled())
    LOG.debug("HTTP2 Close {} ", this);
  super.onClose();
  LifeCycle.stop(strategy);
}

代码示例来源:origin: com.hubspot/SingularityService

public void stop() throws Exception {
 ImmutableSet<LifeCycle> managedObjects = ImmutableSet.copyOf(environment.lifecycle().getManagedObjects());
 for (LifeCycle managed : Lists.reverse(managedObjects.asList())) {
  managed.stop();
 }
}

相关文章