Skip to content

Commit

Permalink
WELD-2585 Synchronize creation of conversation ID generator to avoid …
Browse files Browse the repository at this point in the history
…race conditions.
  • Loading branch information
manovotn committed Aug 5, 2019
1 parent cd3df05 commit 11680ac
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -418,7 +418,8 @@ public String generateConversationId() {
return generator.call();
}

protected ConversationIdGenerator getConversationIdGenerator() {
// method is synchronized so that creation of conversation generator isn't a subject to race condition
protected synchronized ConversationIdGenerator getConversationIdGenerator() {
final R request = associated.get();
if (request == null) {
throw ConversationLogger.LOG.mustCallAssociateBeforeGeneratingId();
Expand Down Expand Up @@ -464,7 +465,7 @@ private void checkIsAssociated() {
}
}

private Map<String, ManagedConversation> getConversationMap() {
private synchronized Map<String, ManagedConversation> getConversationMap() {
checkIsAssociated();
checkContextInitialized();
final R request = getRequest();
Expand Down

0 comments on commit 11680ac

Please sign in to comment.