How I can configure servlet to response with some delay for GET or POST, without using Thread.sleep()?
A:
Do some CPU-intensive task, like calculating Pi with a high precision or a factorial of a big number.
BalusC
2010-07-19 15:41:29
+1
A:
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()
.
Aaron Digulla
2010-07-19 15:42:18