上QQ阅读APP看书,第一时间看更新
The @Timeout policy
The @Timeout annotation could be applied to a class or method to make sure that an operation doesn't last forever:
@Timeout(200)
public void operationCouldTimeout() {
...
}
In the preceding example, the operation will be stopped should it last more than 200 ms.