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.
精彩评论