Example usage for org.springframework.util StopWatch getTotalTimeMillis

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

Introduction

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

Prototype

public long getTotalTimeMillis() 

Source Link

Document

Get the total time in milliseconds for all tasks.

Usage

From source file:org.dd4t.core.filters.impl.DefaultLinkResolverFilter.java

protected void resolvePage(GenericPage page) {

    StopWatch stopWatch = null;
    if (logger.isDebugEnabled()) {
        stopWatch = new StopWatch();
        stopWatch.start();/*from   ww w.j  a  v  a2  s.co  m*/
    }

    List<ComponentPresentation> cpList = page.getComponentPresentations();
    if (cpList != null) {
        for (ComponentPresentation cp : cpList) {
            resolveComponent((GenericComponent) cp.getComponent(), page);
        }
    }
    resolveMap(page.getMetadata());

    if (logger.isDebugEnabled()) {
        stopWatch.stop();
        logger.debug(
                "ResolvePage for " + page.getId() + " finished in " + stopWatch.getTotalTimeMillis() + " ms");
    }
}

From source file:be.craftworkz.ucll.config.apidoc.SwaggerConfiguration.java

/**
 * Swagger Springfox configuration.//from  ww w.  j a  va  2  s .  c om
 */
@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)
            .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();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
}

From source file:com.springboot.demo.config.apidoc.SwaggerConfiguration.java

/**
 * Swagger Springfox configuration./*from   w  w  w .  jav a 2s  .c om*/
 */
@Bean
public Docket swaggerSpringfoxDocket() {
    log.info("Starting Swagger");
    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();
    log.info("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
}

From source file:br.com.rockage.config.apidoc.SwaggerConfiguration.java

/**
 * Swagger Springfox configuration.//from  w ww  .  j av  a2s.  co m
 *
 * @param jHipsterProperties the properties of the application
 * @return the Swagger Springfox configuration
 */
@Bean
public Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) {
    log.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();
    Contact contact = new Contact(jHipsterProperties.getSwagger().getContactName(),
            jHipsterProperties.getSwagger().getContactUrl(), jHipsterProperties.getSwagger().getContactEmail());

    ApiInfo apiInfo = new ApiInfo(jHipsterProperties.getSwagger().getTitle(),
            jHipsterProperties.getSwagger().getDescription(), jHipsterProperties.getSwagger().getVersion(),
            jHipsterProperties.getSwagger().getTermsOfServiceUrl(), contact,
            jHipsterProperties.getSwagger().getLicense(), jHipsterProperties.getSwagger().getLicenseUrl());

    Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).forCodeGeneration(true)
            .genericModelSubstitutes(ResponseEntity.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN))
            .build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
}

From source file:org.dd4t.core.filters.impl.DefaultLinkResolverFilter.java

/**
 * Recursively resolves all components links.
 * /*from w ww .  j  av a2s  . c o  m*/
 * @param item the to resolve the links
 * @param context the requestContext
 */
@Override
public void doFilter(Item item, RequestContext context) throws FilterException {

    this.getLinkResolver().setContextPath(contextPath);

    StopWatch stopWatch = null;
    if (logger.isDebugEnabled()) {
        stopWatch = new StopWatch();
        stopWatch.start();
    }
    if (item instanceof GenericPage) {
        resolvePage((GenericPage) item);
    } else if (item instanceof GenericComponent) {
        resolveComponent((GenericComponent) item);
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug(
                    "DefaultLinkResolverFilter. Item is not a GenericPage or GenericComponent so no component to resolve");
        }
    }
    if (logger.isDebugEnabled()) {
        stopWatch.stop();
        logger.debug("LinkResolverFilter for " + item.getId() + " finished in " + stopWatch.getTotalTimeMillis()
                + " ms");
    }
}

From source file:com.github.aksakalli.todo.config.SwaggerConfiguration.java

/**
 * Swagger Springfox configuration./*from www. j av a  2  s . c  o  m*/
 */
@Bean
public Docket swaggerSpringfoxDocket() {
    log.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();
    Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo())
            .securitySchemes(newArrayList(new BasicAuth("test"))).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();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
}

From source file:org.dd4t.core.filters.impl.DefaultLinkResolverFilter.java

protected void resolveComponent(GenericComponent component, GenericPage page) {

    StopWatch stopWatch = null;
    if (logger.isDebugEnabled()) {
        stopWatch = new StopWatch();
        stopWatch.start();//  w  w w .  j  av a  2 s  .  c om
    }

    if (component != null) {
        // resolve regular content
        resolveMap(component.getContent());
        // resolve metadata
        resolveMap(component.getMetadata());
        /* don't resolve Component itself; 
         * this may very likely lead to performance issues when using
         * the experience manager.
         */
        // getLinkResolver().resolve(component, page);

    }

    if (logger.isDebugEnabled()) {
        stopWatch.stop();
        logger.debug("ResolveComponent for " + component.getId() + " finished in "
                + stopWatch.getTotalTimeMillis() + " ms");
    }
}

From source file:cn.fintecher.print.service.summons.config.apidoc.SwaggerConfiguration.java

/**
 * Swagger Springfox configuration./* ww  w . ja  va 2  s.  c  o  m*/
 *
 * @param summonsServiceProperties the properties of the application
 * @return the Swagger Springfox configuration
 */
@Bean
public Docket swaggerSpringfoxDocket(SummonsServiceProperties summonsServiceProperties) {
    log.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();
    Contact contact = new Contact(summonsServiceProperties.getSwagger().getContactName(),
            summonsServiceProperties.getSwagger().getContactUrl(),
            summonsServiceProperties.getSwagger().getContactEmail());

    ApiInfo apiInfo = new ApiInfo(summonsServiceProperties.getSwagger().getTitle(),
            summonsServiceProperties.getSwagger().getDescription(),
            summonsServiceProperties.getSwagger().getVersion(),
            summonsServiceProperties.getSwagger().getTermsOfServiceUrl(), contact,
            summonsServiceProperties.getSwagger().getLicense(),
            summonsServiceProperties.getSwagger().getLicenseUrl());

    Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).forCodeGeneration(true)
            .genericModelSubstitutes(ResponseEntity.class).select().paths(regex(DEFAULT_INCLUDE_PATTERN))
            .build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
}

From source file:io.github.jhipster.config.apidoc.SwaggerConfiguration.java

/**
 * Swagger Springfox configuration.//from   w ww .  j  a v  a 2  s  .  c  om
 *
 * @param jHipsterProperties the properties of the application
 * @return the Swagger Springfox configuration
 */
@Bean
public Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) {
    log.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();
    Contact contact = new Contact(jHipsterProperties.getSwagger().getContactName(),
            jHipsterProperties.getSwagger().getContactUrl(), jHipsterProperties.getSwagger().getContactEmail());

    ApiInfo apiInfo = new ApiInfo(jHipsterProperties.getSwagger().getTitle(),
            jHipsterProperties.getSwagger().getDescription(), jHipsterProperties.getSwagger().getVersion(),
            jHipsterProperties.getSwagger().getTermsOfServiceUrl(), contact,
            jHipsterProperties.getSwagger().getLicense(), jHipsterProperties.getSwagger().getLicenseUrl());

    Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).forCodeGeneration(true)
            .directModelSubstitute(java.nio.ByteBuffer.class, String.class)
            .genericModelSubstitutes(ResponseEntity.class).select()
            .paths(regex(jHipsterProperties.getSwagger().getDefaultIncludePattern())).build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
}