org.springframework.util.StopWatch.isRunning()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(162)

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

StopWatch.isRunning介绍

[英]Return whether the stop watch is currently running.
[中]返回秒表当前是否正在运行。

代码示例

代码示例来源:origin: spring-projects/spring-data-examples

private static void startStopWatchIfNotRunning(StopWatch stopWatch) {
  if (!stopWatch.isRunning()) {
    stopWatch.start();
  }
}

代码示例来源:origin: spring-projects/spring-data-examples

private static void printBackFromErrorStateInfoIfStopWatchIsRunning(StopWatch stopWatch) {

    if (stopWatch.isRunning()) {
      stopWatch.stop();
      System.err.println("INFO: Recovered after: " + stopWatch.getLastTaskInfo().getTimeSeconds());
    }
  }
}

代码示例来源:origin: spring-projects/spring-framework

if (stopWatch.isRunning()) {
  stopWatch.stop();
  if (stopWatch.isRunning()) {
    stopWatch.stop();

代码示例来源:origin: spring-projects/spring-framework

@Test
public void rejectsStartTwice() {
  sw.start("");
  sw.stop();
  sw.start("");
  assertTrue(sw.isRunning());
  exception.expect(IllegalStateException.class);
  sw.start("");
}

代码示例来源:origin: spring-projects/spring-framework

String name2 = "Task 2";
assertFalse(sw.isRunning());
sw.start(name1);
Thread.sleep(int1);
assertTrue(sw.isRunning());
sw.stop();

代码示例来源:origin: spring-projects/spring-framework

String name2 = "Task 2";
assertFalse(sw.isRunning());
sw.start(name1);
Thread.sleep(int1);
assertTrue(sw.isRunning());
assertEquals(name1, sw.currentTaskName());
sw.stop();

代码示例来源:origin: metatron-app/metatron-discovery

public static void start(String phase) {
 if(!watchThreadLocal.get().isRunning()) {
  watchThreadLocal.get().start(phase);
 }
}

代码示例来源:origin: metatron-app/metatron-discovery

public static void stop() {
 if(watchThreadLocal.get().isRunning()) {
  watchThreadLocal.get().stop();
 }
}

代码示例来源:origin: persado/stevia

public void maskExistingController(Method m) throws Throwable {
  StopWatch watch = new StopWatch("Controller Mask");
  try {
    
    RunsWithController rw = 
        (m.getDeclaringClass().getAnnotation(RunsWithController.class) != null) ? 
              m.getDeclaringClass().getAnnotation(RunsWithController.class) : 
              m.getAnnotation(RunsWithController.class);
    if (null != rw) {
      watch.start("Controller masking");
      Class<? extends WebController> requestedControllerClass = rw.value();
      controllerMask(requestedControllerClass);
      watch.stop();
    } else {
      throw new IllegalStateException("unable to find an entry for the annotation!");
    }
  } finally {
    if (watch.isRunning()) {
      watch.stop();
    }
    LOG.info(watch.shortSummary());
  }
}

代码示例来源:origin: net.oschina.zcx7878/cicada.boot-web

sb.append("\r\n");
sb.append(String.format("出现异常:%s", ex.getMessage()));
if (sw.isRunning())

代码示例来源:origin: persado/stevia

if (null != watch && watch.isRunning()) {
  watch.stop();
  LOG.info(watch.shortSummary());

代码示例来源:origin: persado/stevia

if (null != watch && watch.isRunning()) {
  watch.stop();
  LOG.info(watch.shortSummary());

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-aop

if (stopWatch.isRunning()) {
  stopWatch.stop();
  if (stopWatch.isRunning()) {
    stopWatch.stop();

代码示例来源:origin: apache/servicemix-bundles

if (stopWatch.isRunning()) {
  stopWatch.stop();
  if (stopWatch.isRunning()) {
    stopWatch.stop();

代码示例来源:origin: org.alfresco/alfresco-repository

if(stopWatch.isRunning())

代码示例来源:origin: Alfresco/alfresco-repository

if(stopWatch.isRunning())

相关文章