Fixe documentation to state consumer only access is allowed to poll/peek/peekNode/pollNode

This commit is contained in:
Nitsan Wakart 2014-08-08 15:27:12 +02:00
parent 74d0f0cc6c
commit a1311d4a93

View file

@ -24,7 +24,9 @@ public abstract class AbstractNodeQueue<T> extends AtomicReference<AbstractNodeQ
set(n);
}
/*
/**
* Use this method only from the consumer thread!
*
* !!! There is a copy of this code in pollNode() !!!
*/
@SuppressWarnings("unchecked")
@ -40,7 +42,9 @@ public abstract class AbstractNodeQueue<T> extends AtomicReference<AbstractNodeQ
}
return next;
}
/**
* Use this method only from the consumer thread!
*/
public final T peek() {
final Node<T> n = peekNode();
return (n != null) ? n.value : null;
@ -67,7 +71,9 @@ public abstract class AbstractNodeQueue<T> extends AtomicReference<AbstractNodeQ
return count;
}
/*
/**
* Use this method only from the consumer thread!
*
* !!! There is a copy of this code in pollNode() !!!
*/
public final T poll() {
@ -81,6 +87,9 @@ public abstract class AbstractNodeQueue<T> extends AtomicReference<AbstractNodeQ
}
}
/**
* Use this method only from the consumer thread!
*/
@SuppressWarnings("unchecked")
public final Node<T> pollNode() {
Node<T> tail;