equal
deleted
inserted
replaced
33 public class WakeupSpeed { |
33 public class WakeupSpeed { |
34 |
34 |
35 public static void main(String argv[]) throws Exception { |
35 public static void main(String argv[]) throws Exception { |
36 int waitTime = 4000; |
36 int waitTime = 4000; |
37 Selector selector = Selector.open(); |
37 Selector selector = Selector.open(); |
|
38 try { |
|
39 selector.wakeup(); |
38 |
40 |
39 selector.wakeup(); |
41 long t1 = System.currentTimeMillis(); |
|
42 selector.select(waitTime); |
|
43 long t2 = System.currentTimeMillis(); |
|
44 long totalTime = t2 - t1; |
40 |
45 |
41 long t1 = System.currentTimeMillis(); |
46 if (totalTime > waitTime) |
42 selector.select(waitTime); |
47 throw new RuntimeException("Test failed"); |
43 long t2 = System.currentTimeMillis(); |
48 } finally { |
44 long totalTime = t2 - t1; |
49 selector.close(); |
45 |
50 } |
46 if (totalTime > waitTime) |
|
47 throw new RuntimeException("Test failed"); |
|
48 } |
51 } |
49 |
52 |
50 } |
53 } |