Hi, in my business logic i have a method that should be stopped if the execution takes longer then a second.
Something like this:
For testcases there is the @Timed method. How to implement smth. like tihs?Code:// ... public int doCheck(final String condition) { final int result; try { result = calculate(condition); } catch (final TimeoutException e) { resut = UNKNOWN; } return result; } @Timed(1000) private int calculate(final String condition) { // Calculate ... (if it takes longer then 1 sek. a timeoutException should be thrown) return // calulated result. } // ...
Thanks a lot,
Christian.


Reply With Quote