timed invocation aspect
In the interview Joshua Bloch on Closures, Resource Management, Google, Joshua Bloch mentions, and praises, a facility a google employee created to timeout method invocations. A couple of years ago I had the need for such utility and ended up creating it. That code is nowhere to be seen now, as my employer has changed a couple of times since then.
Most certainly this is a very handy facility in everyday programming. It will be very nice if the "method timeout invocation" concern could be easly integrated into the code using aspects!
@timeout(millis=1000)
public void foo() {
...
}
Where:
/**
* Times out a method invocation. If any of the methods matched by the pointcut invocationToTimeOut() has not
* returned after the specified timeout, the unchecked exception InvocationTimeout will be thrown.
*/
aspect TimeoutInvocation {
...
}
No comments:
Post a Comment