Skip to content

Commit 03e98c7

Browse files
committed
It's unnecessary to wait for messages.
1 parent 386786a commit 03e98c7

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/tinystruct/examples/talk.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
public class talk extends AbstractApplication {
2727

28-
private static final long TIMEOUT = 1;
28+
private static final long TIMEOUT = 10;
2929
private static final int DEFAULT_POOL_SIZE = 3;
3030
protected static final int DEFAULT_MESSAGE_POOL_SIZE = 10;
3131
protected final Map<String, BlockingQueue<Builder>> meetings = new ConcurrentHashMap<String, BlockingQueue<Builder>>();
@@ -107,13 +107,7 @@ public final String save(final Object meetingCode, final Builder builder) {
107107
@Override
108108
public void run() {
109109
Builder message;
110-
do {
111-
try {
112-
Thread.sleep(TIMEOUT);
113-
} catch (InterruptedException e) {
114-
e.printStackTrace();
115-
}
116-
} while(talk.this.meetings.get(meetingCode) == null || (message = talk.this.meetings.get(meetingCode).poll()) == null);
110+
if (talk.this.meetings.get(meetingCode) == null || (message = talk.this.meetings.get(meetingCode).poll()) == null) return;
117111
talk.this.copy(meetingCode, message);
118112
}
119113
});

0 commit comments

Comments
 (0)