开发者

How to imitate slow connection with servlet

How I can configure servlet to response开发者_开发知识库 with some delay for GET or POST, without using Thread.sleep()?


Use Object.wait():

synchronized (this) { this.wait (1000); }

These are the only two ways to wait in Java. Everything else will finally use sleep() or wait().


Do some CPU-intensive task, like calculating Pi with a high precision or a factorial of a big number.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜