@@ -62,6 +62,7 @@ public talk index() {
62
62
63
63
List <String > session_ids ;
64
64
synchronized (this .meetings ) {
65
+ final String sessionId = request .getSession ().getId ();
65
66
if (this .meetings .get (meetingCode ) == null ) {
66
67
this .meetings .put (meetingCode .toString (), new ConcurrentLinkedQueue <Builder >());
67
68
}
@@ -72,8 +73,8 @@ public talk index() {
72
73
this .sessions .put (meetingCode .toString (), session_ids = new ArrayList <String >());
73
74
}
74
75
75
- if (!session_ids .contains (request . getSession (). getId () ))
76
- session_ids .add (request . getSession (). getId () );
76
+ if (!session_ids .contains (sessionId ))
77
+ session_ids .add (sessionId );
77
78
78
79
this .meetings .notifyAll ();
79
80
}
@@ -83,8 +84,8 @@ public talk index() {
83
84
if (!this .list .containsKey (sessionId ))
84
85
{
85
86
this .list .put (sessionId , new ConcurrentLinkedQueue <Builder >());
86
- this .list .notifyAll ();
87
87
}
88
+ this .list .notifyAll ();
88
89
}
89
90
90
91
this .setVariable ("meeting_code" , meetingCode .toString ());
@@ -130,7 +131,8 @@ public String join(String meetingCode) throws ApplicationException {
130
131
public String start (String name ) throws ApplicationException {
131
132
final HttpServletRequest request = (HttpServletRequest ) this .context .getAttribute ("HTTP_REQUEST" );
132
133
final HttpServletResponse response = (HttpServletResponse ) this .context .getAttribute ("HTTP_RESPONSE" );
133
-
134
+ request .getSession ().setAttribute ("user" , name );
135
+
134
136
Object meetingCode = request .getSession ().getAttribute ("meeting_code" );
135
137
if (meetingCode == null ) {
136
138
Reforward reforward = new Reforward (request , response );
@@ -139,7 +141,6 @@ public String start(String name) throws ApplicationException {
139
141
} else {
140
142
this .setVariable ("meeting_code" , meetingCode .toString ());
141
143
}
142
- request .getSession ().setAttribute ("user" , name );
143
144
144
145
return name ;
145
146
}
@@ -197,15 +198,15 @@ public String update() throws ApplicationException, IOException {
197
198
final HttpServletRequest request = (HttpServletRequest ) this .context .getAttribute ("HTTP_REQUEST" );
198
199
final Object meetingCode = request .getSession ().getAttribute ("meeting_code" );
199
200
final String sessionId = request .getSession ().getId ();
200
- if ( meetingCode != null && sessions . get ( meetingCode ) != null && sessions . get ( meetingCode ). contains ( sessionId ) ) {
201
- return update (sessionId );
201
+ if (meetingCode != null ) {
202
+ return this . update (meetingCode . toString (), sessionId );
202
203
}
203
204
return "" ;
204
205
}
205
206
206
207
public String update (String meetingCode , String sessionId ) throws ApplicationException , IOException {
207
- if ( meetingCode != null && sessions .get (meetingCode ) != null && sessions .get (meetingCode ).contains (sessionId )) {
208
- return update (sessionId );
208
+ if (sessions .get (meetingCode ) != null && sessions .get (meetingCode ).contains (sessionId )) {
209
+ return this . update (sessionId );
209
210
}
210
211
return "" ;
211
212
}
@@ -297,8 +298,8 @@ public void sessionCreated(HttpSessionEvent arg0) {
297
298
if (!this .list .containsKey (sessionId ))
298
299
{
299
300
this .list .put (sessionId , new ConcurrentLinkedQueue <Builder >());
300
- this .list .notifyAll ();
301
301
}
302
+ this .list .notifyAll ();
302
303
}
303
304
}
304
305
@@ -315,17 +316,17 @@ public void sessionDestroyed(HttpSessionEvent arg0) {
315
316
}
316
317
if ((messages = meetings .get (meetingCode )) != null ) {
317
318
messages .remove (meetingCode );
318
- meetings .notifyAll ();
319
319
}
320
+ meetings .notifyAll ();
320
321
}
321
322
322
323
synchronized (this .list ) {
323
324
final String sessionId = arg0 .getSession ().getId ();
324
325
if (this .list .containsKey (sessionId ))
325
326
{
326
327
this .list .remove (sessionId );
327
- this .list .notifyAll ();
328
328
}
329
+ this .list .notifyAll ();
329
330
}
330
331
}
331
332
}
0 commit comments