Mercurial > hg > RemoteEditor > REPSessionManager
comparison rep/Session.java @ 356:b18c24dcc5d2
Before chaning put/join scheme for ditributed select.
author | kono |
---|---|
date | Sat, 18 Oct 2008 19:01:40 +0900 |
parents | 1e605880d49e |
children | 034acadc0cdc |
comparison
equal
deleted
inserted
replaced
355:98607350f7d1 | 356:b18c24dcc5d2 |
---|---|
8 private Forwarder masterEditor; | 8 private Forwarder masterEditor; |
9 private int sessionID; | 9 private int sessionID; |
10 private String sessionName; | 10 private String sessionName; |
11 private LinkedList<EditorPlus> editorList = new LinkedList<EditorPlus>(); | 11 private LinkedList<EditorPlus> editorList = new LinkedList<EditorPlus>(); |
12 private boolean isOwner = false; | 12 private boolean isOwner = false; |
13 private int eidSeed = 0; | |
14 private Forwarder firstForwarder; | 13 private Forwarder firstForwarder; |
15 | 14 |
16 public Session(int sid, String name, Forwarder editor) { | 15 public Session(int sid, String name, Forwarder editor) { |
17 this(sid, editor); | 16 this(sid, editor); |
18 sessionName = name; | 17 sessionName = name; |
63 } | 62 } |
64 public String getName() { | 63 public String getName() { |
65 return sessionName; | 64 return sessionName; |
66 } | 65 } |
67 | 66 |
68 public int newEid() { | |
69 int eid=0; | |
70 boolean flag = true; | |
71 while(flag) { | |
72 eid=eidSeed++; | |
73 for(EditorPlus e:editorList) { | |
74 if((flag = (eid==e.eid))) break; | |
75 } | |
76 } | |
77 return eid; | |
78 } | |
79 | 67 |
80 public boolean deleteEditor(REPSocketChannel<REPCommand> channel) { | 68 public boolean deleteEditor(REPSocketChannel<REPCommand> channel) { |
81 boolean flag = false; | 69 boolean flag = false; |
82 | 70 |
83 for (Iterator<EditorPlus> it = editorList.iterator();it.hasNext(); ) { | 71 for (Iterator<EditorPlus> it = editorList.iterator();it.hasNext(); ) { |