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

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

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

LifeCycle.isRunning介绍

暂无

代码示例

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

/**
 * Adds the given bean, detecting whether to manage it or not.
 * If the bean is a {@link LifeCycle}, then it will be managed if it is not
 * already started and not managed if it is already started.
 * The {@link #addBean(Object, boolean)}
 * method should be used if this is not correct, or the {@link #manage(Object)} and {@link #unmanage(Object)}
 * methods may be used after an add to change the status.
 *
 * @param o the bean object to add
 * @return true if the bean was added, false if it was already present
 */
@Override
public boolean addBean(Object o)
{
  if (o instanceof LifeCycle)
  {
    LifeCycle l = (LifeCycle)o;
    return addBean(o,l.isRunning()?Managed.UNMANAGED:Managed.AUTO);
  }
  return addBean(o,Managed.POJO);
}

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

/**
 * Adds a managed lifecycle.
 * <p>This is a convenience method that uses addBean(lifecycle,true)
 * and then ensures that the added bean is started iff this container
 * is running.  Exception from nested calls to start are caught and 
 * wrapped as RuntimeExceptions
 * @param lifecycle the managed lifecycle to add
 */
public void addManaged(LifeCycle lifecycle)
{
  addBean(lifecycle,true);
  try
  {
    if (isRunning() && !lifecycle.isRunning())
      start(lifecycle);
  }
  catch (RuntimeException | Error e)
  {
    throw e;
  }
  catch (Exception e)
  {
    throw new RuntimeException(e);
  }
}

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

if (!l.isRunning())
  start(l);
break;
if (l.isRunning())
  unmanage(b);
else

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

if (!lc.isRunning()) {
  try {
    lc.start();

代码示例来源: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: org.eclipse.jetty/jetty-util

if (!l.isRunning())
  start(l);
if (isStarting())
  if (l.isRunning())
    unmanage(new_bean);
  else if (_doStarted)

代码示例来源: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.sonatype.nexus/nexus-bootstrap

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-webapp

/**
 * Stop the joined lifecycle beans in the reverse order they were added.
 * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
 */
@Override
protected void doStop() throws Exception
{
  _started=false;
  super.doStop();
  List<Bean> reverse = new ArrayList<Bean>(_beans);
  Collections.reverse(reverse);
  for (Bean b:reverse)
  {
    if (b._managed && b._bean instanceof LifeCycle)
    {
      LifeCycle l=(LifeCycle)b._bean;
      if (l.isRunning())
        l.stop();
    }
  }
}

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

/**
 * Stop the joined lifecycle beans in the reverse order they were added.
 * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
 */
@Override
protected void doStop() throws Exception
{
  _started=false;
  super.doStop();
  List<Bean> reverse = new ArrayList<Bean>(_beans);
  Collections.reverse(reverse);
  for (Bean b:reverse)
  {
    if (b._managed && b._bean instanceof LifeCycle)
    {
      LifeCycle l=(LifeCycle)b._bean;
      if (l.isRunning())
        l.stop();
    }
  }
}

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

/**
 * Stops the managed lifecycle beans in the reverse order they were added.
 */
@Override
protected void doStop() throws Exception
{
  _doStarted = false;
  super.doStop();
  List<Bean> reverse = new ArrayList<>(_beans);
  Collections.reverse(reverse);
  for (Bean b : reverse)
  {
    if (b._managed==Managed.MANAGED && b._bean instanceof LifeCycle)
    {
      LifeCycle l = (LifeCycle)b._bean;
      if (l.isRunning())
        stop(l);
    }
  }
}

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

/**
 * Stop the joined lifecycle beans in the reverse order they were added.
 * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
 */
@Override
protected void doStop() throws Exception
{
  _started=false;
  super.doStop();
  List<Bean> reverse = new ArrayList<Bean>(_beans);
  Collections.reverse(reverse);
  for (Bean b:reverse)
  {
    if (b._managed && b._bean instanceof LifeCycle)
    {
      LifeCycle l=(LifeCycle)b._bean;
      if (l.isRunning())
        l.stop();
    }
  }
}

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

/**
 * Start the managed lifecycle beans in the order they were added.
 * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
 */
@Override
protected void doStart() throws Exception
{
  for (Bean b:_beans)
  {
    if (b._managed && b._bean instanceof LifeCycle)
    {
      LifeCycle l=(LifeCycle)b._bean;
      if (!l.isRunning())
        l.start();
    }
  }
  // indicate that we are started, so that addBean will start other beans added.
  _started=true;
  super.doStart();
}

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

/**
 * Start the managed lifecycle beans in the order they were added.
 * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
 */
@Override
protected void doStart() throws Exception
{
  for (Bean b:_beans)
  {
    if (b._managed && b._bean instanceof LifeCycle)
    {
      LifeCycle l=(LifeCycle)b._bean;
      if (!l.isRunning())
        l.start();
    }
  }
  // indicate that we are started, so that addBean will start other beans added.
  _started=true;
  super.doStart();
}

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

/**
 * Start the managed lifecycle beans in the order they were added.
 * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
 */
@Override
protected void doStart() throws Exception
{
  for (Bean b:_beans)
  {
    if (b._managed && b._bean instanceof LifeCycle)
    {
      LifeCycle l=(LifeCycle)b._bean;
      if (!l.isRunning())
        l.start();
    }
  }
  // indicate that we are started, so that addBean will start other beans added.
  _started=true;
  super.doStart();
}

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

@Override
protected void doStart() throws Exception
{
  super.doStart();
  if (_threadPool == null)
  {
    _threadPool = getServer().getThreadPool();
    _privateThreadPool = false;
  }
  if (_threadPool instanceof LifeCycle && !((LifeCycle)_threadPool).isRunning())
    ((LifeCycle)_threadPool).start();
  _selectorManager.start();
}

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

@Override
protected void doStart() throws Exception
{
  super.doStart();
  if (_threadPool == null)
  {
    _threadPool = getServer().getThreadPool();
    _privateThreadPool = false;
  }
  if (_threadPool instanceof LifeCycle && !((LifeCycle)_threadPool).isRunning())
    ((LifeCycle)_threadPool).start();
  _selectorManager.start();
}

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

@Override
protected void doStart() throws Exception
{
  super.doStart();
  if (_threadPool == null)
  {
    _threadPool = getServer().getThreadPool();
    _privateThreadPool = false;
  }
  if (_threadPool instanceof LifeCycle && !((LifeCycle)_threadPool).isRunning())
    ((LifeCycle)_threadPool).start();
  _selectorManager.start();
}

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

@Override
protected void doStart() throws Exception
{
  super.doStart();
  if (_threadPool == null)
  {
    _threadPool = getServer().getThreadPool();
    _privateThreadPool = false;
  }
  if (_threadPool instanceof LifeCycle && !((LifeCycle)_threadPool).isRunning())
    ((LifeCycle)_threadPool).start();
  _selectorManager.start();
}

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

@Override
protected void doStart() throws Exception
{
  super.doStart();
  if (_threadPool == null)
  {
    _threadPool = getServer().getThreadPool();
    _privateThreadPool = false;
  }
  if (_threadPool instanceof LifeCycle && !((LifeCycle)_threadPool).isRunning())
    ((LifeCycle)_threadPool).start();
  _selectorManager.start();
}

相关文章