Skip to content

Commit b831bd0

Browse files
authored
Merge pull request #86 from oracle/owls-79787
fixes race condition in messages queue
2 parents 921588c + e4ff967 commit b831bd0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/io/prometheus/wls/rest/MessagesServlet.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2019, 2020, Oracle Corporation and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

@@ -14,6 +14,7 @@
1414
import java.util.ArrayList;
1515
import java.util.List;
1616
import java.util.Queue;
17+
import java.util.concurrent.ConcurrentLinkedDeque;
1718

1819
import static io.prometheus.wls.rest.ServletConstants.MESSAGES_PAGE;
1920

@@ -25,7 +26,7 @@ public class MessagesServlet extends HttpServlet {
2526
static final int MAX_EXCHANGES = 5;
2627
private static final String TEMPLATE = "REQUEST:%n%s%nREPLY:%n%s%n";
2728

28-
private static Queue<String> messages = new ArrayDeque<>();
29+
private static Queue<String> messages = new ConcurrentLinkedDeque<>();
2930

3031
@Override
3132
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {

0 commit comments

Comments
 (0)