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

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

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

StopWatch.resume介绍

[英]Resume the stopwatch after a suspend.

This method resumes the watch after it was suspended. The watch will not include time between the suspend and resume calls in the total time.
[中]暂停后恢复秒表。
此方法会在暂停后恢复手表。手表将不包括暂停和恢复通话之间的总时间。

代码示例

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

@Test
public void testStopWatchSuspend() {
  final StopWatch watch = new StopWatch();
  watch.start();
  try {
    Thread.sleep(550);
  } catch (final InterruptedException ex) {
  }
  watch.suspend();
  final long suspendTime = watch.getTime();
  try {
    Thread.sleep(550);
  } catch (final InterruptedException ex) {
  }
  watch.resume();
  try {
    Thread.sleep(550);
  } catch (final InterruptedException ex) {
  }
  watch.stop();
  final long totalTime = watch.getTime();
  assertTrue(suspendTime >= 500);
  assertTrue(suspendTime < 700);
  assertTrue(totalTime >= 1000);
  assertTrue(totalTime < 1300);
}

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

watch.resume();
  fail("Calling resume on an unsuspended StopWatch should throw an exception. ");
} catch (final IllegalStateException ise) {
  watch.resume();
  fail("Calling resume on an unsuspended StopWatch should throw an exception. ");
} catch (final IllegalStateException ise) {

代码示例来源: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: fhoeben/hsac-fitnesse-fixtures

/**
 * Resumes named timer (after it was paused).
 * @param name name of timer to resume.
 */
public void resumeTimer(String name) {
  StopWatch sw = getStopWatch(name);
  sw.resume();
}

代码示例来源:origin: jhpoelen/eol-globi-data

public String logProgress(int counter, StopWatch stopWatch) {
  stopWatch.suspend();
  String msg = "linked [%d] reference(s) in [%.1f] s  at rate of [%.1f] references/s)";
  stopWatch.resume();
  return String.format(msg, counter, stopWatch.getTime() / 1000.0, 1000.0 * counter / stopWatch.getTime());
}

代码示例来源:origin: uk.ac.ebi/jutils

/**
 * If {@link #isSuspended()} invokes {@link #resume()} as usually. If {@link #isStopped()} calls {@link #start()}, 
 * if neither is true, it means it's already started and hence does nothing.
 */
public void resumeOrStart ()
{
  if ( isStopped () ) super.start ();
  else if ( isSuspended () ) super.resume ();
  // or, it is already running
}

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

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

代码示例来源:origin: mjugo/StreamingRec

inBetweenTrainTime.resume();
  testee.train(Collections.singletonList(articleEvent), Collections.EMPTY_LIST);
  inBetweenTrainTime.suspend();
  testTime.resume();
} else {
  inBetweenTrainTime.resume();
  testee.train(Collections.EMPTY_LIST, Collections.singletonList(wpC.clickData));
  inBetweenTrainTime.suspend();
  testTime.resume();

相关文章