List of usage examples for org.springframework.util StopWatch stop
public void stop() throws IllegalStateException
From source file:com.emc.smartcomm.UregApplication.java
/** * @param register A SmartRegister instance *//*from w w w. ja va2 s . c o m*/ public void uregApplication(SmartRegister register) { logger.info("Processing UREG Tranasctional Flow:"); GrsiRequest greq = PopulateData.setGrsiRequest(); GrsiResponse grsiResponse = PopulateData.setGrsiResponse(); BabProtocolRequest breq = PopulateData.setBabRequest(); BabProtocolResponse bres = PopulateData.setBabResponse(); ValidateRegRequest vreg = PopulateData.setValidateRegRequest(); ValidateRegResponse vres = PopulateData.setValidateRegResponse(); greq.setSvcFlag(register.getChannel()); String msg = register.toString(); String path = "/appl/LogTransaction.txt"; Timestamp txStartTime = PrepareLog.getCurrentTimeStamp(); StopWatch sw = new StopWatch("UREG Transaction"); sw.start("UREG Transaction"); logger.debug("UREG Transaction Initiated:{}", txStartTime); StopWatch sw0 = new StopWatch("UREG REQUEST"); sw0.start("UREG REQUEST"); uregTemplate.convertAndSend(msg); sw0.stop(); logger.debug(sw0.prettyPrint()); logger.debug(sw0.shortSummary()); StopWatch sw1 = new StopWatch("GRSI Request"); sw1.start("GRSI Request"); grsiTemplate.convertAndSend(greq); sw1.stop(); logger.debug(sw1.prettyPrint()); logger.debug(sw1.shortSummary()); if ("PVS".equals(grsiResponse.getsx12())) // || "BAB".equals(grsiResponse.getsx13())) { StopWatch sw2 = new StopWatch("Validate Request:"); sw2.start("Validate Request:"); String validateRegText = vreg.toString(); validateRegTemplate.convertAndSend(validateRegText); sw2.stop(); logger.debug(sw2.prettyPrint()); logger.debug(sw2.shortSummary()); } if ("PPC".equals(grsiResponse.getsx03())) { StopWatch sw3 = new StopWatch("BAB Request"); sw3.start("BAB Request:"); babTemplate.convertAndSend("bab.Request", breq.toString()); sw3.stop(); logger.debug(sw3.prettyPrint()); logger.debug(sw3.shortSummary()); } grsiResponse.setsx03("NSN"); if ("NSN".equals(grsiResponse.getsx03())) { InputStream is = getClass().getResourceAsStream("/mock/SOAPProtocolRecharge.txt"); String message = FileReader.readFile(is); StopWatch sw4 = new StopWatch("SOAP Recharge Request: "); sw4.start("SOAP Recharge Request:"); soapRechargeTemplate.convertAndSend(message); sw4.stop(); logger.debug(sw4.prettyPrint()); logger.debug(sw4.shortSummary()); } Timestamp txEndTime = PrepareLog.getCurrentTimeStamp(); logger.debug("Persisting Transaction log in gemxd and oracle"); LogTransaction logTransaction = PrepareLog.prepareLog(greq, grsiResponse, breq, bres, vreg, vres); logTransaction.setTxnStartTime(txStartTime); logTransaction.setTxnEndTime(txEndTime); StopWatch sw5 = new StopWatch("Transaction Persistence: "); sw5.start("Transaction Persistence:"); logTransactionService.logTransaction(logTransaction); sw5.stop(); logger.debug(sw5.prettyPrint()); logger.debug(sw5.shortSummary()); ExternalFileWriter.writeToFile(path, PopulateData.populateLog()); sw.stop(); logger.debug(sw.prettyPrint()); logger.debug(sw.shortSummary()); logger.debug("UREG Transaction is Completed:{}", txEndTime); logger.info("UREG Transaction TimeSpan:{}", (txEndTime.getTime() - txStartTime.getTime())); }
From source file:profiling.ProfilingInterceptor.java
@Override public Object invoke(MethodInvocation mi) throws Throwable { StopWatch sw = new StopWatch(); sw.start(mi.getMethod().getName());/* www .j a v a 2 s. c o m*/ String methodName = mi.getMethod().getName(); if ("sayNigga".equals(methodName)) { System.out.println("FUCK YOU NIGGA!"); return null; } Object returnValue = mi.proceed(); sw.stop(); dumpInfo(mi, sw.getTotalTimeMillis()); return returnValue; }
From source file:org.ansoya.drugs.configuration.SwaggerConfiguration.java
@Bean public Docket swaggerSpringfoxDocket() { log.debug("Starting Swagger"); StopWatch watch = new StopWatch(); watch.start();/*from www . j av a2 s . com*/ 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:fr.acxio.tools.agia.alfresco.MultiLineNodeListItemReaderTest.java
@Test @DirtiesContext// w w w . java2 s . c om public void testReadMixedIndex() throws Exception { StopWatch aStopWatch = new StopWatch("testReadMixedIndex"); aStopWatch.start("Read first value"); List<FieldSet> aRecord = multiLineNodeListItemReader.read(); assertNotNull(aRecord); assertEquals(2, aRecord.size()); aStopWatch.stop(); aStopWatch.start("Read 2nd value"); aRecord = multiLineNodeListItemReader.read(); assertNotNull(aRecord); assertEquals(1, aRecord.size()); aStopWatch.stop(); aStopWatch.start("Read 3rd value"); aRecord = multiLineNodeListItemReader.read(); assertNotNull(aRecord); assertEquals(2, aRecord.size()); aStopWatch.stop(); aStopWatch.start("Read 4th value"); aRecord = multiLineNodeListItemReader.read(); assertNotNull(aRecord); assertEquals(1, aRecord.size()); aStopWatch.stop(); aStopWatch.start("Read 5th value"); aRecord = multiLineNodeListItemReader.read(); assertNull(aRecord); aStopWatch.stop(); System.out.println(aStopWatch.prettyPrint()); }
From source file:org.networking.config.SwaggerConfig.java
@Bean public Docket swaggerSpringfoxDocket() { StopWatch watch = new StopWatch(); watch.start();/*from w w w. jav a2 s .com*/ 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.persistent.cloudninja.scheduler.DeploymentMonitor.java
@Override public boolean execute() { boolean retVal = true; try {/*from w w w . j a va2s . c om*/ StopWatch watch = new StopWatch(); watch.start(); StringBuffer roleInfo = getRoleInfoForDeployment(); parseRoleInfo(roleInfo); watch.stop(); taskCompletionDao.updateTaskCompletionDetails(watch.getTotalTimeSeconds(), "ProcessMonitorInstanceCount", ""); } catch (Exception e) { LOGGER.error(e.getMessage(), e); retVal = false; } return retVal; }
From source file:org.nebulaframework.grid.Grid.java
/** * Starts a Light-weight {@link GridNode} (a GridNode without * Job Execution Support, that is non-worker) with default * settings, read from default properties file. * //from www . j a v a 2 s.co m * @param useConfigDiscovery indicates whether to use information * from configuration to discover * * @param isGui indicates that the application is a GUI based * application and any disconnection notifications should be * done through message boxes. * * @return GridNode * * @throws IllegalStateException if a Grid Member (Cluster / Node) has * already started with in the current VM. Nebula supports only one Grid * Member per VM. */ public synchronized static GridNode startLightGridNode(boolean useConfigDiscovery, final boolean isGui) throws IllegalStateException { if (isInitialized()) { // A Grid Member has already started in this VM throw new IllegalStateException("A Grid Memeber Already Started in VM"); } initializeDefaultExceptionHandler(); StopWatch sw = new StopWatch(); try { sw.start(); // Set Security Manager System.setSecurityManager(new SecurityManager()); Properties config = ConfigurationSupport.detectNodeConfiguration(); log.info("GridNode Attempting Discovery..."); // Discover Cluster If Needed GridNodeDiscoverySupport.discover(config, useConfigDiscovery); checkJMSBroker(config.getProperty(ConfigurationKeys.CLUSTER_SERVICE.value())); // If we reach here, connection test succeeded log.debug("Starting up Spring Container..."); applicationContext = new NebulaApplicationContext(GRIDNODE_LIGHT_CONTEXT, config); log.debug("Spring Container Started"); node = true; lightweight = true; sw.stop(); log.info("GridNode Started Up. " + sw.getLastTaskTimeMillis() + " ms"); GridNode node = (GridNode) applicationContext.getBean("localNode"); ServiceEventsSupport.addServiceHook(new ServiceHookCallback() { @Override public void onServiceEvent(ServiceMessage message) { log.warn("[GridNode] Disconnected from Cluster"); log.warn("[GridNode] Shutting Down"); if (isGui) { JOptionPane.showMessageDialog(UISupport.activeWindow(), "Disconnected from Cluster, terminating VM"); } System.exit(0); } }, node.getClusterId().toString(), ServiceMessageType.NODE_DISCONNECTED); return node; } finally { if (sw.isRunning()) { sw.stop(); } } }
From source file:ch.alv.sysinfos.config.apidoc.SwaggerConfiguration.java
/** * Swagger Spring MVC configuration./* ww w .j av a2 s . com*/ */ @Bean public SwaggerSpringMvcPlugin swaggerSpringMvcPlugin(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; }
From source file:com.kb.config.apidoc.SwaggerConfiguration.java
/** * Swagger Spring MVC configuration.//from w w w .j av 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; }
From source file:org.zalando.zmon.actuator.ZmonMetricsFilter.java
@Override protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws ServletException, IOException { StopWatch stopWatch = new StopWatch(); stopWatch.start();/*from ww w. j a v a 2 s . c om*/ String path = new UrlPathHelper().getPathWithinApplication(request); int status = HttpStatus.INTERNAL_SERVER_ERROR.value(); try { chain.doFilter(request, response); status = getStatus(response); } finally { stopWatch.stop(); metricsWrapper.recordClientRequestMetrics(request, path, status, stopWatch.getTotalTimeMillis()); } }