List of usage examples for org.springframework.util StopWatch StopWatch
public StopWatch()
From source file:eu.transparency.lobbycal.config.apidoc.SwaggerConfiguration.java
/** * Swagger Springfox configuration.//from ww w .j av a 2 s . c om */ @Bean @Profile({ "!" + Constants.SPRING_PROFILE_DEVELOPMENT }) 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; }
From source file:br.com.rockage.config.apidoc.SwaggerConfiguration.java
/** * Swagger Springfox configuration./*from w w w . jav a 2s. c o 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:com.github.aksakalli.todo.config.SwaggerConfiguration.java
/** * Swagger Springfox configuration.//from www . ja va 2s . co 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:com.todo.backend.config.SwaggerConfiguration.java
@Bean public Docket swaggerSpringfoxDocket() { log.debug("Initializing swagger..."); final StopWatch watch = new StopWatch(); watch.start();/*from www .j a va 2 s . co m*/ final Docket docket = new Docket(DocumentationType.SWAGGER_2).forCodeGeneration(true) .genericModelSubstitutes(ResponseEntity.class).ignoredParameterTypes(Pageable.class) .ignoredParameterTypes(java.sql.Date.class) .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class) .directModelSubstitute(java.time.ZonedDateTime.class, Date.class) .directModelSubstitute(java.time.LocalTime.class, Date.class).select() .paths(PathSelectors.regex("/api/.*")).build(); watch.stop(); log.debug("Swagger started in {} ms", watch.getTotalTimeMillis()); return docket; }
From source file:no.arkivlab.hioa.nikita.webapp.spring.SwaggerConfig.java
@Bean public Docket swaggerDocket() { // @formatter:off logger.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start();/*from w w w .j av a 2s. c o m*/ Contact contact = new Contact(webappProperties.getSwagger().getContactName(), webappProperties.getSwagger().getContactUrl(), webappProperties.getSwagger().getContactEmail()); ApiInfo apiInfo = new ApiInfo(webappProperties.getSwagger().getTitle(), webappProperties.getSwagger().getDescription(), webappProperties.getSwagger().getVersion(), webappProperties.getSwagger().getTermsOfServiceUrl(), contact, webappProperties.getSwagger().getLicense(), webappProperties.getSwagger().getLicenseUrl()); Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).forCodeGeneration(true) .genericModelSubstitutes(ResponseEntity.class).ignoredParameterTypes(Pageable.class) .ignoredParameterTypes(java.sql.Date.class) .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class) .directModelSubstitute(java.time.ZonedDateTime.class, Date.class) .directModelSubstitute(java.time.LocalDateTime.class, Date.class).select() .apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()).build() .pathMapping(Constants.HATEOAS_API_PATH).genericModelSubstitutes(ResponseEntity.class); watch.stop(); logger.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return docket; // @formatter:on }
From source file:br.com.antharys.config.apidoc.SwaggerConfiguration.java
/** * Swagger Springfox configuration./*from www . j av a 2s . 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) .genericModelSubstitutes(ResponseEntity.class).ignoredParameterTypes(java.sql.Date.class) .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.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.focusns.common.web.performance.MonitorFilter.java
@Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { ///*w ww. ja v a 2 s. c o m*/ if (log.isTraceEnabled()) { // String requestDesc = getRequestDescription(request); StopWatch stopWatch = new StopWatch(); stopWatch.start(requestDesc); // filterChain.doFilter(request, response); // stopWatch.stop(); // log.trace(stopWatch.prettyPrint()); } else { filterChain.doFilter(request, response); } }
From source file:com.ahmedeid.app.config.apidoc.SwaggerConfiguration.java
/** * Swagger Springfox configuration.// w w w.j a v a2 s . c o 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).ignoredParameterTypes(Pageable.class) .ignoredParameterTypes(java.sql.Date.class) .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.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.quartzdesk.executor.core.job.AbstractJob.java
/** * The method invoked by the Quartz scheduler. * * @param context a {@link JobExecutionContext} instance. * @throws JobExecutionException if an error occurs while executing the job. *///from w ww . j av a2 s. co m @Override public final void execute(JobExecutionContext context) throws JobExecutionException { String jobFullName = context.getJobDetail().getKey().toString(); StopWatch sw = new StopWatch(); sw.start(); ClassLoader origContextClassLoader = Thread.currentThread().getContextClassLoader(); try { if (log.isInfoEnabled()) log.info("Started scheduled job: {}", jobFullName); if (log.isDebugEnabled()) { StringBuilder jobDataMapDump = new StringBuilder(); // map that contains merged job data from the job detail data map and trigger data map JobDataMap jobDataMap = context.getMergedJobDataMap(); for (Iterator<String> keys = jobDataMap.keySet().iterator(); keys.hasNext();) { String key = keys.next(); String value = CommonUtils.safeToString(jobDataMap.get(key)); jobDataMapDump.append(key).append('=').append(value); if (keys.hasNext()) jobDataMapDump.append(CommonConst.NL); } log.debug("Job data map dump:{}{}", CommonConst.NL, jobDataMapDump.toString()); } // Set the context class loader to be the class loader of the job class. // This is a workaround/fix for the WebSpere Application Server where // WebSphere work manager threads are typically used to execute jobs. Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); executeJob(context); sw.stop(); if (log.isInfoEnabled()) log.info("Finished scheduled job: {}. Time taken: {}s.", jobFullName, sw.getTotalTimeSeconds()); } catch (JobExecutionException e) { if (log.isErrorEnabled()) log.error("Error executing scheduled job: " + jobFullName, e); throw e; } finally { // restore the original thread context class loader Thread.currentThread().setContextClassLoader(origContextClassLoader); } }
From source file:com.kb.config.apidoc.SwaggerConfiguration.java
/** * Swagger Spring MVC configuration.//from w ww . j a v a 2 s .c om */ @Bean public SwaggerSpringMvcPlugin swaggerSpringMvcPlugin(final SpringSwaggerConfig springSwaggerConfig) { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start(); SwaggerSpringMvcPlugin swaggerSpringMvcPlugin = new SwaggerSpringMvcPlugin(springSwaggerConfig) .apiInfo(apiInfo()).genericModelSubstitutes(ResponseEntity.class) .includePatterns(DEFAULT_INCLUDE_PATTERN); swaggerSpringMvcPlugin.build(); watch.stop(); log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis()); return swaggerSpringMvcPlugin; }