Skip to content

Commit 3cd289a

Browse files
authored
Merge pull request #8 from tinystruct/master
Reverted to the last version for talk.java, since it has been processed in smalltalk.java
2 parents 8ebb6fe + ff77c5b commit 3cd289a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/tinystruct/examples/smalltalk.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ public String update() throws ApplicationException, IOException {
213213
public String update(String meetingCode, String sessionId) throws ApplicationException, IOException {
214214
String error = "{ \"error\": \"expired\" }";
215215
if (this.meetings.containsKey(meetingCode)) {
216-
if(sessions.get(meetingCode) != null && sessions.get(meetingCode).contains(sessionId)) {
216+
List<String> list;
217+
if((list = sessions.get(meetingCode)) != null && list.contains(sessionId)) {
217218
return this.update(sessionId);
218219
}
219220
error = "{ \"error\": \"session-timeout\" }";
@@ -330,7 +331,7 @@ public void sessionDestroyed(HttpSessionEvent arg0) {
330331

331332
Queue<Builder> messages;
332333
List<String> session_ids;
333-
synchronized (this.meetings) {
334+
synchronized (this.meetings) {
334335
if((session_ids = this.sessions.get(meetingCode)) != null) {
335336
session_ids.remove(arg0.getSession().getId());
336337
}

src/tinystruct/examples/talk.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,19 @@ public void run() {
125125
* @throws IOException
126126
*/
127127
public final String update(final String sessionId) throws ApplicationException, IOException {
128-
Builder message = null;
128+
Builder message;
129129
Queue<Builder> messages;
130130
synchronized (this.list) {
131131
messages = this.list.get(sessionId);
132-
while(messages != null && (message = messages.poll()) == null) {
132+
while((message = messages.poll()) == null) {
133133
try {
134134
this.list.wait(TIMEOUT);
135135
} catch (InterruptedException e) {
136136
throw new ApplicationException(e.getMessage(), e);
137137
}
138138
}
139139

140-
return message != null ? message.toString() : "";
140+
return message.toString();
141141
}
142142
}
143143

0 commit comments

Comments
 (0)