Example usage for org.springframework.util StopWatch StopWatch

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

Introduction

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

Prototype

public StopWatch() 

Source Link

Document

Construct a new StopWatch .

Usage

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

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

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

@Bean
public Docket swaggerSpringfoxDocket() {
    log.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();/*  w w w .ja  v a2s.c o m*/
    Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
            .genericModelSubstitutes(ResponseEntity.class).forCodeGeneration(true)
            .ignoredParameterTypes(XMLGregorianCalendar.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN))
            .build();
    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();//from w  w w . j  av a  2  s  . co m
    final Object val = method.proceed();
    stopWatch.stop();
    logger.debug(createMessage(method.getMethod().getName(), stopWatch.getTotalTimeMillis()));
    return val;
}

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

@Bean
public Docket swaggerSpringfoxDocket() {
    StopWatch watch = new StopWatch();
    watch.start();/*from  ww  w.  jav a2s . c om*/
    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();

    return docket;
}

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

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

From source file:com.adama.api.config.apidoc.SwaggerConfiguration.java

/**
 * Swagger Springfox configuration./*from   w w w  .  j  a  v a2s. c om*/
 *
 * @param adamaProperties
 *            the properties of the application
 * @return the Swagger Springfox configuration
 */
@Bean
public Docket swaggerSpringfoxDocket(AdamaProperties adamaProperties) {
    log.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();
    Contact contact = new Contact(adamaProperties.getSwagger().getContactName(),
            adamaProperties.getSwagger().getContactUrl(), adamaProperties.getSwagger().getContactEmail());
    ApiInfo apiInfo = new ApiInfo(adamaProperties.getSwagger().getTitle(),
            adamaProperties.getSwagger().getDescription(), adamaProperties.getSwagger().getVersion(),
            adamaProperties.getSwagger().getTermsOfServiceUrl(), contact,
            adamaProperties.getSwagger().getLicense(), adamaProperties.getSwagger().getLicenseUrl());
    Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).forCodeGeneration(true)
            .genericModelSubstitutes(ResponseEntity.class).ignoredParameterTypes(Pageable.class)
            .useDefaultResponseMessages(false).directModelSubstitute(java.time.ZonedDateTime.class, Date.class)
            .directModelSubstitute(java.time.LocalDateTime.class, Date.class).select()
            .apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.boot")))
            .paths(regex("/.*")).build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
}

From source file:org.ansoya.drugs.configuration.SwaggerConfiguration.java

@Bean
public Docket swaggerSpringfoxDocket() {
    log.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();/*  ww w .  j  a v  a 2s . co m*/
    Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
            .genericModelSubstitutes(ResponseEntity.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN)) // and by paths
            .build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;

    /*
    ApiInfo apiInfo = new ApiInfo("sample of springboot", "sample of springboot", null, null, null, null, null);
    Docket docket = new Docket(DocumentationType.SWAGGER_2).select().paths(regex(DEFAULT_INCLUDE_PATTERN)).build()
        .apiInfo(apiInfo).useDefaultResponseMessages(false);
    return docket;
    */
}

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();//from  w  ww .ja v a 2  s.co m
    Docket docket = getDocket(applicationProperties);
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
}

From source file:com.pubkit.SwaggerConfig.java

/**
 * Swagger Spring MVC configuration.//  w  w  w .j a va  2  s  .  c o m
 */
@Bean
public SwaggerSpringMvcPlugin swaggerSpringMvcPlugin(SpringSwaggerConfig springSwaggerConfig) {
    log.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();
    SwaggerSpringMvcPlugin swaggerSpringMvcPlugin = new SwaggerSpringMvcPlugin(springSwaggerConfig)
            .apiInfo(apiInfo()).directModelSubstitute(Date.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class).includePatterns(DEFAULT_INCLUDE_PATTERN);

    swaggerSpringMvcPlugin.build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return swaggerSpringMvcPlugin;
}

From source file:com.csg.health.config.apidoc.SwaggerConfiguration.java

/**
 * Swagger Springfox configuration./*from w  w  w  .ja  v a2 s .  com*/
 */
@Bean
@Profile("!" + Constants.SPRING_PROFILE_FAST)
public Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) {
    log.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();
    ApiInfo apiInfo = new ApiInfo(jHipsterProperties.getSwagger().getTitle(),
            jHipsterProperties.getSwagger().getDescription(), jHipsterProperties.getSwagger().getVersion(),
            jHipsterProperties.getSwagger().getTermsOfServiceUrl(),
            jHipsterProperties.getSwagger().getContact(), jHipsterProperties.getSwagger().getLicense(),
            jHipsterProperties.getSwagger().getLicenseUrl());

    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();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
}