22
|
1 package rep;
|
|
2
|
23
|
3 import java.util.LinkedList;
|
|
4
|
356
|
5 public class EditorList extends LinkedList<Editor> {
|
23
|
6
|
356
|
7 /**
|
|
8 *
|
|
9 */
|
|
10 private static final long serialVersionUID = 1L;
|
|
11 private int eid_root=0;
|
|
12 private LinkedList<Editor> waiting= new LinkedList<Editor>();
|
|
13
|
|
14
|
|
15 public void addWaitingEditor(Editor fw) {
|
|
16 waiting.add(fw);
|
22
|
17 }
|
|
18
|
24
|
19
|
356
|
20 public void assignSessionManagerIDtoWaitingSM(int eid) {
|
|
21 // 待っていたEditorにEditor IDを登録し,Session Manager List
|
|
22 // に登録する。この後、EditorのPUT/JOINに従って、ACKを送り、EID
|
|
23 // を確定する。
|
|
24 Editor waiter;
|
|
25 if ((waiter=waiting.poll())!=null) {
|
|
26 waiter.setEID(eid);
|
|
27 add(waiter);
|
|
28 return;
|
23
|
29 }
|
356
|
30 assert false;
|
24
|
31 }
|
22
|
32
|
31
|
33
|
356
|
34 public int newEid() {
|
|
35 return ++eid_root;
|
76
|
36 }
|
|
37
|
85
|
38
|
356
|
39 public boolean waiting(Editor editor) {
|
|
40 return waiting.contains(editor);
|
85
|
41 }
|
|
42
|
91
|
43
|
22
|
44 }
|