Example usage for org.springframework.util StopWatch start

List of usage examples for org.springframework.util StopWatch start

Introduction

In this page you can find the example usage for org.springframework.util StopWatch start.

Prototype

public void start() throws IllegalStateException 

Source Link

Document

Start an unnamed task.

Usage

From source file:org.networking.config.SwaggerConfig.java

@Bean
public Docket swaggerSpringfoxDocket() {
    StopWatch watch = new StopWatch();
    watch.start();
    Docket swaggerSpringMvcPlugin = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
            .genericModelSubstitutes(ResponseEntity.class).select()
            .paths(PathSelectors.regex(DEFAULT_INCLUDE_PATTERNS)) // and by paths
            .build();/*from  ww  w  .ja va 2  s  . c o  m*/
    watch.stop();
    return swaggerSpringMvcPlugin;
}

From source file:com.chf.sample.spring.config.SwaggerConfig.java

@Bean
public Docket swaggerSpringfoxDocket() {
    StopWatch watch = new StopWatch();
    watch.start();
    Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
            .genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true)
            .genericModelSubstitutes(ResponseEntity.class)
            .directModelSubstitute(java.time.LocalDate.class, String.class)
            .directModelSubstitute(java.time.ZonedDateTime.class, Date.class)
            .directModelSubstitute(java.time.LocalDateTime.class, Date.class).select()
            .paths(regex(DEFAULT_INCLUDE_PATTERN)).build();
    watch.stop();//from  w ww  .  j  a  v a 2 s . co m
    return docket;
}

From source file:org.zalando.zmon.actuator.ZmonRestResponseBackendMetricsInterceptor.java

@Override
public ClientHttpResponse intercept(final HttpRequest request, final byte[] body,
        final ClientHttpRequestExecution execution) throws IOException {

    StopWatch stopwatch = new StopWatch();
    stopwatch.start();
    ClientHttpResponse response = execution.execute(request, body);
    stopwatch.stop();//  w ww  .j  a  v a  2 s. c om
    metricsWrapper.recordBackendRoundTripMetrics(request, response, stopwatch);
    return response;
}

From source file:com.baocy.tut2.Tut2Receiver.java

@RabbitHandler
public void receive(String in) throws InterruptedException {
    StopWatch watch = new StopWatch();
    watch.start();
    System.out.println("instance " + this.instance + " [x] Received '" + in + "'");
    doWork(in);/* w  ww.  j  a  va2s.  com*/
    watch.stop();
    System.out.println("instance " + this.instance + " [x] Done in " + watch.getTotalTimeSeconds() + "s");
}

From source file:com.baocy.tut3.Tut3Receiver.java

public void receive(String in, int receiver) throws InterruptedException {
    StopWatch watch = new StopWatch();
    watch.start();
    System.out.println("instance " + receiver + " [x] Received '" + in + "'");
    doWork(in);/*from  www  .  j a  v  a  2 s .co  m*/
    watch.stop();
    System.out.println("instance " + receiver + " [x] Done in " + watch.getTotalTimeSeconds() + "s");
}

From source file:com.mediaiq.aggregator.configurations.SwaggerConfiguration.java

@Bean
public Docket swaggerSpringfoxDocket() {
    log.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();
    Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
            .genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true)
            .ignoredParameterTypes(XMLGregorianCalendar.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN))
            .build();/*from ww w. ja v  a  2 s  .c  om*/
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
}

From source file:org.sventon.advice.StopWatchAroundAdvice.java

@Override
public Object invoke(final MethodInvocation method) throws Throwable {
    final StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    final Object val = method.proceed();
    stopWatch.stop();//w  w  w .  j  a  va  2 s  . c o  m
    logger.debug(createMessage(method.getMethod().getName(), stopWatch.getTotalTimeMillis()));
    return val;
}

From source file:fi.helsinki.opintoni.integration.interceptor.LoggingInterceptor.java

@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
        throws IOException {
    StopWatch stopWatch = new StopWatch();
    stopWatch.start();

    ClientHttpResponse response = execution.execute(request, body);

    stopWatch.stop();/*from   w  w w  . ja v a  2s .  co  m*/

    log.info("Response for {} took {} seconds", request.getURI(), stopWatch.getTotalTimeSeconds());

    return response;
}

From source file:com.priitlaht.ppwebtv.common.config.apidoc.SwaggerConfiguration.java

@Bean
public Docket swaggerSpringfoxDocket(ApplicationProperties applicationProperties) {
    log.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();
    Docket docket = getDocket(applicationProperties);
    watch.stop();/*from  ww  w .  jav  a  2s . co  m*/
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
}

From source file:com.ascend.campaign.configs.SwaggerConfig.java

@Bean
public Docket swaggerSpringfoxDocket() {
    StopWatch watch = new StopWatch();
    watch.start();
    Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
            .genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true)
            .genericModelSubstitutes(ResponseEntity.class)
            .directModelSubstitute(org.joda.time.LocalDate.class, String.class)
            .directModelSubstitute(org.joda.time.LocalDateTime.class, Date.class)
            .directModelSubstitute(org.joda.time.DateTime.class, Date.class)
            .directModelSubstitute(java.time.LocalDate.class, String.class)
            .directModelSubstitute(java.time.ZonedDateTime.class, Date.class)
            .directModelSubstitute(java.time.LocalDateTime.class, Date.class).select()
            .paths(regex(DEFAULT_INCLUDE_PATTERN)).build();
    watch.stop();/*from w w  w.j  a  va2s .c  o m*/

    return docket;
}