You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: eventmesh-storage-plugin/eventmesh-storage-standalone/src/main/java/org/apache/eventmesh/storage/standalone/broker/MessageQueue.java
+40-17Lines changed: 40 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -24,18 +24,21 @@
24
24
25
25
importcom.google.common.base.Preconditions;
26
26
27
+
importlombok.Getter;
28
+
27
29
/**
28
30
* This is a block queue, can get entity by offset. The queue is a FIFO data structure.
29
31
*/
30
32
publicclassMessageQueue {
31
33
34
+
@Getter
32
35
privatefinalMessageEntity[] items;
33
36
34
-
privateinttakeIndex;
37
+
privatevolatileinttakeIndex;
35
38
36
-
privateintputIndex;
39
+
privatevolatileintputIndex;
37
40
38
-
privateintcount;
41
+
privatevolatileintcount;
39
42
40
43
privatefinalReentrantLocklock;
41
44
@@ -59,9 +62,10 @@ public MessageQueue(int capacity) {
59
62
}
60
63
61
64
/**
62
-
* Insert the message at the tail of this queue, waiting for space to become available if the queue is full
65
+
* Inserts the specified MessageEntity object into the queue.
63
66
*
64
-
* @param messageEntity
67
+
* @param messageEntity The MessageEntity object to be inserted into the queue.
68
+
* @throws InterruptedException if the current thread is interrupted while waiting for space to become available in the queue.
0 commit comments