Created
July 22, 2012 15:50
-
-
Save d6y/3160058 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Block { | |
R execute() throws X; | |
} | |
public R time(String opName, Block block) throws X { | |
long startTime = System.nanoTime(); | |
boolean success = true; | |
try { | |
return block.execute(); | |
} catch (final Throwable ex) { | |
success = false; | |
throw ex; | |
} finally { | |
recordTiming( | |
"opName", System.nanoTime() - startTime, success ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment