KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > application > test > GreeterWithConstructorDelay


1 package org.objectweb.celtix.application.test;
2
3 public class GreeterWithConstructorDelay {
4     private static int delay;
5
6     public GreeterWithConstructorDelay() {
7         try {
8             Thread.sleep(getDelay());
9         } catch (InterruptedException JavaDoc ex) {
10             // ignore
11
}
12     }
13
14     private synchronized int getDelay() {
15         delay = (delay + 250) % 500;
16         return delay;
17     }
18 }
19
Popular Tags