use of org.springframework.util.StopWatch in project nikita-noark5-core by HiOA-ABI.
the class SwaggerConfig method swaggerDocket.
@Bean
public Docket swaggerDocket() {
// @formatter:off
logger.debug("Starting Swagger");
StopWatch watch = new StopWatch();
watch.start();
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
}
use of org.springframework.util.StopWatch in project cu-kfs by CU-CommunityApps.
the class AccountReversionCurrentYearAccountStep method getCustomBatchExecutor.
/**
* @see org.kuali.kfs.sys.batch.AbstractWrappedBatchStep#getCustomBatchExecutor()
*/
@Override
protected CustomBatchExecutor getCustomBatchExecutor() {
return new CustomBatchExecutor() {
/**
* Runs the account reversion process, retrieving parameter, creating the origin entry group for output entries, and
* generating the reports on the process.
* @return true if the job completed successfully, false if otherwise
* @see org.kuali.kfs.kns.bo.Step#execute(String, java.util.Date)
*/
public boolean execute() {
StopWatch stopWatch = new StopWatch();
stopWatch.start("AccountReversionCurrentYearAccountStep");
Map jobParameters = accountReversionProcessService.getJobParameters();
Map<String, Integer> accountReversionCounts = new HashMap<String, Integer>();
getYearEndService().logAllMissingSubFundGroups((Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR));
getAccountReversionProcessService().reversionCurrentYearAccountProcess(jobParameters, accountReversionCounts);
stopWatch.stop();
LOG.info("AccountReversionCurrentYearAccountStep took " + (stopWatch.getTotalTimeSeconds() / 60.0) + " minutes to complete");
return true;
}
};
}
use of org.springframework.util.StopWatch in project cu-kfs by CU-CommunityApps.
the class AccountReversionPriorYearAccountStep method getCustomBatchExecutor.
/**
* @see org.kuali.kfs.sys.batch.AbstractWrappedBatchStep#getCustomBatchExecutor()
*/
@Override
protected CustomBatchExecutor getCustomBatchExecutor() {
return new CustomBatchExecutor() {
/**
* Runs the account reversion process, retrieving parameter, creating the origin entry group for output entries, and
* generating the reports on the process.
* @return true if the job completed successfully, false if otherwise
* @see org.kuali.kfs.kns.bo.Step#execute(java.lang.String)
*/
public boolean execute() {
StopWatch stopWatch = new StopWatch();
stopWatch.start("AccountReversionPriorYearAccountStep");
Map jobParameters = accountReversionProcessService.getJobParameters();
Map<String, Integer> accountReversionCounts = new HashMap<String, Integer>();
getYearEndService().logAllMissingPriorYearAccounts((Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR));
getYearEndService().logAllMissingSubFundGroups((Integer) jobParameters.get(KFSConstants.UNIV_FISCAL_YR));
getAccountReversionProcessService().reversionPriorYearAccountProcess(jobParameters, accountReversionCounts);
stopWatch.stop();
LOG.info("Account ReversionPriorYearAccountStep took " + (stopWatch.getTotalTimeSeconds() / 60.0) + " minutes to complete");
return true;
}
};
}
use of org.springframework.util.StopWatch in project spring-integration by spring-projects.
the class MessageHistoryIntegrationTests method testMessageHistoryWithHistoryPerformance.
@Test
@Ignore
public void testMessageHistoryWithHistoryPerformance() {
ConfigurableApplicationContext acWithHistory = new ClassPathXmlApplicationContext("perfWithMessageHistory.xml", MessageHistoryIntegrationTests.class);
ConfigurableApplicationContext acWithoutHistory = new ClassPathXmlApplicationContext("perfWithoutMessageHistory.xml", MessageHistoryIntegrationTests.class);
SampleGateway gatewayHistory = acWithHistory.getBean("sampleGateway", SampleGateway.class);
DirectChannel endOfThePipeChannelHistory = acWithHistory.getBean("endOfThePipeChannel", DirectChannel.class);
endOfThePipeChannelHistory.subscribe(message -> {
MessageChannel replyChannel = (MessageChannel) message.getHeaders().getReplyChannel();
replyChannel.send(message);
});
SampleGateway gateway = acWithoutHistory.getBean("sampleGateway", SampleGateway.class);
DirectChannel endOfThePipeChannel = acWithoutHistory.getBean("endOfThePipeChannel", DirectChannel.class);
endOfThePipeChannel.subscribe(message -> {
MessageChannel replyChannel = (MessageChannel) message.getHeaders().getReplyChannel();
replyChannel.send(message);
});
StopWatch stopWatch = new StopWatch();
stopWatch.start();
for (int i = 0; i < 10000; i++) {
gatewayHistory.echo("hello");
}
stopWatch.stop();
logger.info("Elapsed time with history 10000 calls: " + stopWatch.getTotalTimeSeconds());
stopWatch = new StopWatch();
stopWatch.start();
for (int i = 0; i < 10000; i++) {
gateway.echo("hello");
}
stopWatch.stop();
logger.info("Elapsed time without history 10000 calls: " + stopWatch.getTotalTimeSeconds());
acWithHistory.close();
acWithoutHistory.close();
}
use of org.springframework.util.StopWatch in project spring-integration by spring-projects.
the class AggregatorTests method testAggPerfDefaultPartial.
@Test
public void testAggPerfDefaultPartial() throws InterruptedException, ExecutionException, TimeoutException {
AggregatingMessageHandler handler = new AggregatingMessageHandler(new DefaultAggregatingMessageGroupProcessor());
handler.setCorrelationStrategy(message -> "foo");
handler.setReleasePartialSequences(true);
DirectChannel outputChannel = new DirectChannel();
handler.setOutputChannel(outputChannel);
final CompletableFuture<Collection<?>> resultFuture = new CompletableFuture<>();
outputChannel.subscribe(message -> {
Collection<?> payload = (Collection<?>) message.getPayload();
logger.warn("Received " + payload.size());
resultFuture.complete(payload);
});
SimpleMessageStore store = new SimpleMessageStore();
SimpleMessageGroupFactory messageGroupFactory = new SimpleMessageGroupFactory(SimpleMessageGroupFactory.GroupType.BLOCKING_QUEUE);
store.setMessageGroupFactory(messageGroupFactory);
handler.setMessageStore(store);
StopWatch stopwatch = new StopWatch();
stopwatch.start();
for (int i = 0; i < 120000; i++) {
if (i % 10000 == 0) {
stopwatch.stop();
logger.warn("Sent " + i + " in " + stopwatch.getTotalTimeSeconds() + " (10k in " + stopwatch.getLastTaskTimeMillis() + "ms)");
stopwatch.start();
}
handler.handleMessage(MessageBuilder.withPayload("foo").setSequenceSize(120000).setSequenceNumber(i + 1).build());
}
stopwatch.stop();
logger.warn("Sent " + 120000 + " in " + stopwatch.getTotalTimeSeconds() + " (10k in " + stopwatch.getLastTaskTimeMillis() + "ms)");
Collection<?> result = resultFuture.get(10, TimeUnit.SECONDS);
assertNotNull(result);
assertEquals(120000, result.size());
// actually < 2.0, was many minutes
assertThat(stopwatch.getTotalTimeSeconds(), lessThan(60.0));
}
Aggregations