assertEquals("Number of fallback semaphores in use", 0, cmd.getFallbackSemaphore().getNumberOfPermitsUsed()); assertFalse(cmd.isExecutionComplete()); assertEquals(null, cmd.getFailedExecutionException()); assertNull(cmd.getExecutionException()); assertTrue(cmd.getExecutionTimeInMilliseconds() > -1);
assertEquals("Number of fallback semaphores in use", 0, cmd.getFallbackSemaphore().getNumberOfPermitsUsed()); assertFalse(cmd.isExecutionComplete()); assertEquals(null, cmd.getFailedExecutionException()); assertNull(cmd.getExecutionException()); System.out.println("Execution time : " + cmd.getExecutionTimeInMilliseconds());
/** * Copies various parameters like execution events,time and any exception after command execution.<br/><br/> * <b>Should be called only after execution of command completes</b> * @param executor Executor used to execute this request. * @return */ @SuppressWarnings({ "rawtypes", "unchecked" }) public Builder withCommandData(Executor executor) { HystrixCommand command = (HystrixCommand) executor; withEventList(command.getExecutionEvents()) .withExecutionTime(command.getExecutionTimeInMilliseconds()) .withException((Exception) command.getFailedExecutionException()); return this; }