mirror of
https://github.com/corda/corda.git
synced 2025-01-23 21:08:48 +00:00
implement ConcurrentLinkedQueue.clear
This commit is contained in:
parent
bcb62af2a1
commit
a2c6cc8882
@ -25,6 +25,11 @@ public class ConcurrentLinkedQueue<T> {
|
|||||||
private volatile Node<T> head = new Node(null, null);
|
private volatile Node<T> head = new Node(null, null);
|
||||||
private volatile Node<T> tail = head;
|
private volatile Node<T> tail = head;
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
// todo: can we safely make this O(1)?
|
||||||
|
while (poll() != null) { }
|
||||||
|
}
|
||||||
|
|
||||||
public boolean add(T value) {
|
public boolean add(T value) {
|
||||||
Node<T> n = new Node(value, null);
|
Node<T> n = new Node(value, null);
|
||||||
while (true) {
|
while (true) {
|
||||||
|
Loading…
Reference in New Issue
Block a user