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

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

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

StopWatch.isSuspended介绍

[英]This method is used to find out whether the StopWatch is suspended.
[中]此方法用于确定秒表是否暂停。

代码示例

代码示例来源: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 resumeStreaming() throws Exception {
  this.dispatchConsoleMessage(MessageType.INFO, "\n**** Resuming file transfer. ****\n\n");
  resumeStreamingEvent();
  this.comm.resumeSend();
  this.setCurrentState(COMM_SENDING);
  if (streamStopWatch.isSuspended()) {
    this.streamStopWatch.resume();
  }
}

代码示例来源: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: rmagen/elastic-gremlin

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

相关文章