org.apache.commons.lang3.time.StopWatch.isStarted()方法的使用及代码示例

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

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

StopWatch.isStarted介绍

[英]The method is used to find out if the StopWatch is started. A suspended StopWatch is also started watch.
[中]该方法用于确定秒表是否启动。暂停的秒表也被称为启动表。

代码示例

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testStopWatchStatic() {
  final StopWatch watch = StopWatch.createStarted();
  assertTrue(watch.isStarted());
}

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testBooleanStates() {
  final StopWatch watch = new StopWatch();
  assertFalse(watch.isStarted());
  assertFalse(watch.isSuspended());
  assertTrue(watch.isStopped());
  watch.start();
  assertTrue(watch.isStarted());
  assertFalse(watch.isSuspended());
  assertFalse(watch.isStopped());
  watch.suspend();
  assertTrue(watch.isStarted());
  assertTrue(watch.isSuspended());
  assertFalse(watch.isStopped());
  watch.stop();
  assertFalse(watch.isStarted());
  assertFalse(watch.isSuspended());
  assertTrue(watch.isStopped());
}

代码示例来源:origin: winder/Universal-G-Code-Sender

@Override
public void pauseStreaming() throws Exception {
  this.dispatchConsoleMessage(MessageType.INFO,"\n**** Pausing file transfer. ****\n\n");
  pauseStreamingEvent();
  this.comm.pauseSend();
  this.setCurrentState(COMM_SENDING_PAUSED);
  if (streamStopWatch.isStarted() && !streamStopWatch.isSuspended()) {
    this.streamStopWatch.suspend();
  }
}

代码示例来源:origin: lwaddicor/spring-startup-analysis

/**
 * Called after a bean is constructed. Saves bean creation details.
 *
 * @param bean The bean being created.
 * @param beanName The name of the bean being created.
 * @return The bean being created.
 * @throws BeansException
 */
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
  StopWatch stopWatch = beanStopWatchMap.get(beanName);
  if (stopWatch != null && stopWatch.isStarted()) {
    stopWatch.stop();
    if (!inFactoryBean) {
      long deltaT = stopWatch.getTime();
      StartTimeStatisticDto bss = new StartTimeStatisticDto(bean.getClass().toString(), deltaT);
      times.add(bss);
    }
  }
  inFactoryBean = true;
  return bean;
}

代码示例来源:origin: rmagen/elastic-gremlin

public void start() {
  if(!sw.isStarted()) {
    sw.start();
    return;
  }
  if(!sw.isSuspended()) stop();
  sw.resume();
}

相关文章