comparison rep/channel/SelectorSimulator.java @ 430:03ab374605a6

Test program termination.
author one
date Sat, 02 Jan 2010 04:16:25 +0900
parents b8efd57faf78
children
comparison
equal deleted inserted replaced
429:c2e4759eddcb 430:03ab374605a6
22 super(null); 22 super(null);
23 keyList = new HashMap<SelectableChannel,SelectionKeySimulator<P>>(); 23 keyList = new HashMap<SelectableChannel,SelectionKeySimulator<P>>();
24 } 24 }
25 25
26 public int select() throws IOException { 26 public int select() throws IOException {
27 while(true) { 27 getSelectedKeys();
28 getSelectedKeys(); 28 if(selectedKeys.isEmpty()) {
29 if(selectedKeys.isEmpty()) { 29 try {
30 try { 30 synchronized(this) {
31 synchronized(this) { 31 wait();
32 wait();
33 }
34 } catch (InterruptedException e) {
35 throw new IOException();
36 } 32 }
37 } else 33 } catch (InterruptedException e) {
38 break; 34 throw new IOException();
35 }
39 } 36 }
40 return selectedKeys.size(); 37 return selectedKeys.size();
41 } 38 }
42 39
43 @Override 40 @Override