Mercurial > hg > RemoteEditor > REPSessionManager
comparison rep/SessionManager.java @ 356:b18c24dcc5d2
Before chaning put/join scheme for ditributed select.
author | kono |
---|---|
date | Sat, 18 Oct 2008 19:01:40 +0900 |
parents | 98607350f7d1 |
children | 034acadc0cdc |
comparison
equal
deleted
inserted
replaced
355:98607350f7d1 | 356:b18c24dcc5d2 |
---|---|
48 | 48 |
49 LinkedList<Session> sessionList; | 49 LinkedList<Session> sessionList; |
50 private SessionManagerGUI gui; | 50 private SessionManagerGUI gui; |
51 private REPSelector<REPCommand> selector; | 51 private REPSelector<REPCommand> selector; |
52 SessionManagerList smList; | 52 SessionManagerList smList; |
53 List<Editor> editorList; | 53 EditorList editorList; |
54 // editorList は、sessionList に入っているeditorとは別なeditorのlistらしい。 | 54 // editorList は、sessionList に入っているeditorとは別なeditorのlistらしい。 |
55 // private String maxHost; | 55 // private String maxHost; |
56 private List<PacketSet> waitingCommandInMerge; | 56 private List<PacketSet> waitingCommandInMerge; |
57 private BlockingQueue<SessionManagerEvent> waitingEventQueue = new LinkedBlockingQueue<SessionManagerEvent>();; | 57 private BlockingQueue<SessionManagerEvent> waitingEventQueue = new LinkedBlockingQueue<SessionManagerEvent>();; |
58 String myHost; | 58 String myHost; |
109 ssc.register(selector, SelectionKey.OP_ACCEPT, | 109 ssc.register(selector, SelectionKey.OP_ACCEPT, |
110 new Forwarder(this)); | 110 new Forwarder(this)); |
111 | 111 |
112 sessionList = new LinkedList<Session>(); | 112 sessionList = new LinkedList<Session>(); |
113 smList = new SessionManagerList(); | 113 smList = new SessionManagerList(); |
114 editorList = new LinkedList<Editor>(); | 114 editorList = new EditorList(); |
115 waitingCommandInMerge = new LinkedList<PacketSet>(); | 115 waitingCommandInMerge = new LinkedList<PacketSet>(); |
116 | 116 |
117 | 117 |
118 } | 118 } |
119 | 119 |
359 if(editor == null){ | 359 if(editor == null){ |
360 logger.writeLog("SessionManager.selectSession():editor = " + editor); | 360 logger.writeLog("SessionManager.selectSession():editor = " + editor); |
361 return; | 361 return; |
362 } | 362 } |
363 if (editor.hasSession()) return; | 363 if (editor.hasSession()) return; |
364 //REPSocketChannel<REPCommand> channel = editor.getChannel(); | 364 if (editorList.waiting(editor)) return; |
365 | 365 |
366 // System.out.println("SessionManager.session.hasOnwer="+session.hasOwner()); | |
367 if(session.hasOwner()){ | 366 if(session.hasOwner()){ |
368 editor.setEID(session.newEid()); | 367 editor.setEID(editorList.newEid()); |
369 editor.setSID(sid); | 368 editor.setSID(sid); |
370 session.addForwarder(editor); | 369 session.addForwarder(editor); |
371 REPCommand sendCommand = new REPCommand(); | 370 REPCommand sendCommand = new REPCommand(); |
372 sendCommand.setCMD(REP.SMCMD_JOIN_ACK); | 371 sendCommand.setCMD(REP.SMCMD_JOIN_ACK); |
373 sendCommand.setEID(editor.getEID()); | 372 sendCommand.setEID(editor.getEID()); |