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

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

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

LifeCycle.isStarted介绍

暂无

代码示例

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

public static String getState(LifeCycle lc)
{
  if (lc.isStarting()) return STARTING;
  if (lc.isStarted()) return STARTED;
  if (lc.isStopping()) return STOPPING;
  if (lc.isStopped()) return STOPPED;
  return FAILED;
}

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

/**
 * Add an associated bean.
 * If the bean is a {@link LifeCycle}, then it will be managed if it is not 
 * already started and umanaged 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 or false if it has already been added.
 */
public boolean addBean(Object o)
{
  // beans are joined unless they are started lifecycles
  return addBean(o,!((o instanceof LifeCycle)&&((LifeCycle)o).isStarted()));
}

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

/**
 * Add an associated bean.
 * If the bean is a {@link LifeCycle}, then it will be managed if it is not 
 * already started and umanaged 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 or false if it has already been added.
 */
public boolean addBean(Object o)
{
  // beans are joined unless they are started lifecycles
  return addBean(o,!((o instanceof LifeCycle)&&((LifeCycle)o).isStarted()));
}

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

/**
 * Add an associated bean.
 * If the bean is a {@link LifeCycle}, then it will be managed if it is not 
 * already started and umanaged 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 or false if it has already been added.
 */
public boolean addBean(Object o)
{
  // beans are joined unless they are started lifecycles
  return addBean(o,!((o instanceof LifeCycle)&&((LifeCycle)o).isStarted()));
}

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

/**
 * Add an associated bean.
 * If the bean is a {@link LifeCycle}, then it will be managed if it is not 
 * already started and umanaged 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 or false if it has already been added.
 */
public boolean addBean(Object o)
{
  // beans are joined unless they are started lifecycles
  return addBean(o,!((o instanceof LifeCycle)&&((LifeCycle)o).isStarted()));
}

代码示例来源:origin: org.cometd.java/cometd-java-server

/**
 * <p>Sets the thread pool associated to this CometD service.</p>
 * <p>If the {@link ThreadPool} is a {@link LifeCycle} instance,
 * and it is not already started, then it will started.</p>
 *
 * @param pool The ThreadPool
 */
public void setThreadPool(ThreadPool pool) {
  try {
    if (pool instanceof LifeCycle) {
      if (!((LifeCycle)pool).isStarted()) {
        ((LifeCycle)pool).start();
      }
    }
  } catch (Exception e) {
    throw new IllegalStateException(e);
  }
  _threadPool = pool;
}

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

private void stopLifeCycles(Predicate<LifeCycle> predicate, boolean destroy)
  {
    List<LifeCycle> lifeCycles = new ArrayList<>();
    synchronized (this)
    {
      lifeCycles.addAll(_lifeCycles);
    }
    for (LifeCycle l : lifeCycles)
    {
      try
      {
        if (l.isStarted() && predicate.test(l))
          l.stop();
        if ((l instanceof Destroyable) && destroy)
          ((Destroyable)l).destroy();
      }
      catch (Throwable x)
      {
        debug(x);
      }
    }
  }
}

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

public static String getState(LifeCycle lc)
{
  if (lc.isStarting()) return STARTING;
  if (lc.isStarted()) return STARTED;
  if (lc.isStopping()) return STOPPING;
  if (lc.isStopped()) return STOPPED;
  return FAILED;
}

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

public static String getState(LifeCycle lc)
{
  if (lc.isStarting()) return STARTING;
  if (lc.isStarted()) return STARTED;
  if (lc.isStopping()) return STOPPING;
  if (lc.isStopped()) return STOPPED;
  return FAILED;
}

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

public static String getState(LifeCycle lc)
{
  if (lc.isStarting()) return STARTING;
  if (lc.isStarted()) return STARTED;
  if (lc.isStopping()) return STOPPING;
  if (lc.isStopped()) return STOPPED;
  return FAILED;
}

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

public static String getState(LifeCycle lc)
{
  if (lc.isStarting()) return STARTING;
  if (lc.isStarted()) return STARTED;
  if (lc.isStopping()) return STOPPING;
  if (lc.isStopped()) return STOPPED;
  return FAILED;
}

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

public static String getState(LifeCycle lc)
{
  if (lc.isStarting()) return STARTING;
  if (lc.isStarted()) return STARTED;
  if (lc.isStopping()) return STOPPING;
  if (lc.isStopped()) return STOPPED;
  return FAILED;
}

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

public static String getState(LifeCycle lc)
{
  if (lc.isStarting()) return STARTING;
  if (lc.isStarted()) return STARTED;
  if (lc.isStopping()) return STOPPING;
  if (lc.isStopped()) return STOPPED;
  return FAILED;
}

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

public static String getState(LifeCycle lc)
{
  if (lc.isStarting()) return STARTING;
  if (lc.isStarted()) return STARTED;
  if (lc.isStopping()) return STOPPING;
  if (lc.isStopped()) return STOPPED;
  return FAILED;
}

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

public static String getState(LifeCycle lc)
{
  if (lc.isStarting()) return STARTING;
  if (lc.isStarted()) return STARTED;
  if (lc.isStopping()) return STOPPING;
  if (lc.isStopped()) return STOPPED;
  return FAILED;
}

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

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

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

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

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

@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: org.eclipse.jetty.aggregate/jetty-server

@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);
      }
    }
  }
}

相关文章